> ## Documentation Index
> Fetch the complete documentation index at: https://piyushvyas.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Tools Reference

> Complete reference for all 23+ MCP tools exposed by the BAP MCP server.

# MCP Tools Reference

The BAP MCP server exposes 23 tools organized into six categories. With `--slim` mode, only 5 essential tools are exposed.

## Navigation

<AccordionGroup>
  <Accordion title="navigate">
    Navigate to a URL. Supports fused observation via the `observe` parameter.

    <ParamField path="url" type="string" required>
      The URL to navigate to.
    </ParamField>

    <ParamField path="waitUntil" type="string" default="load">
      When to consider navigation complete: `load`, `domcontentloaded`, `networkidle`.
    </ParamField>

    <ParamField path="observe" type="object">
      Fuse observation with navigation. Returns page elements alongside the navigation result.

      <ParamField path="observe.maxElements" type="number" default="50">
        Maximum number of elements to return.
      </ParamField>

      <ParamField path="observe.responseTier" type="string">
        Response tier: `full`, `interactive`, `minimal`.
      </ParamField>
    </ParamField>

    ```
    navigate({ url: "https://example.com", observe: { maxElements: 20 } })
    ```
  </Accordion>

  <Accordion title="go_back">
    Navigate back in browser history.

    No parameters.
  </Accordion>

  <Accordion title="go_forward">
    Navigate forward in browser history.

    No parameters.
  </Accordion>

  <Accordion title="reload">
    Reload the current page.

    No parameters.
  </Accordion>
</AccordionGroup>

## Element Interaction

<AccordionGroup>
  <Accordion title="click">
    Click an element using semantic selectors.

    <ParamField path="selector" type="string" required>
      Element selector (see [Selector Formats](#selector-formats) below).
    </ParamField>
  </Accordion>

  <Accordion title="fill">
    Fill a form field. Clears existing content first.

    <ParamField path="selector" type="string" required>
      Element selector targeting the input field.
    </ParamField>

    <ParamField path="value" type="string" required>
      The value to fill.
    </ParamField>
  </Accordion>

  <Accordion title="type">
    Type text character by character. First clicks the element, then types. Triggers individual key events.

    <ParamField path="selector" type="string" required>
      Element selector.
    </ParamField>

    <ParamField path="text" type="string" required>
      Text to type character by character.
    </ParamField>

    <ParamField path="delay" type="number">
      Delay in milliseconds between keystrokes.
    </ParamField>
  </Accordion>

  <Accordion title="press">
    Press keyboard keys (Enter, Tab, shortcuts).

    <ParamField path="key" type="string" required>
      Key to press (e.g., `Enter`, `Tab`, `Escape`, `Control+a`).
    </ParamField>

    <ParamField path="selector" type="string">
      Optional element to focus before pressing.
    </ParamField>
  </Accordion>

  <Accordion title="select">
    Select an option from a dropdown.

    <ParamField path="selector" type="string" required>
      Element selector targeting the `<select>` element.
    </ParamField>

    <ParamField path="value" type="string" required>
      Option value or visible text to select.
    </ParamField>
  </Accordion>

  <Accordion title="scroll">
    Scroll the page or a specific element.

    <ParamField path="direction" type="string" default="down">
      Scroll direction: `up`, `down`, `left`, `right`.
    </ParamField>

    <ParamField path="amount" type="number" default="300">
      Pixels to scroll.
    </ParamField>

    <ParamField path="selector" type="string">
      Optional element to scroll into view.
    </ParamField>
  </Accordion>

  <Accordion title="hover">
    Hover over an element.

    <ParamField path="selector" type="string" required>
      Element selector.
    </ParamField>
  </Accordion>
</AccordionGroup>

## Observation

<AccordionGroup>
  <Accordion title="observe">
    AI-optimized page observation. Returns interactive elements with stable refs. Supports incremental diffs and response tiers.

    <ParamField path="maxElements" type="number" default="50">
      Maximum elements to return.
    </ParamField>

    <ParamField path="filterRoles" type="string[]">
      Filter by ARIA roles (e.g., `["button", "link", "textbox"]`).
    </ParamField>

    <ParamField path="includeScreenshot" type="boolean" default="false">
      Include an annotated screenshot with element refs.
    </ParamField>

    <ParamField path="incremental" type="boolean" default="false">
      Return only changes since the last observation: `{ added, updated, removed }`.
    </ParamField>

    <ParamField path="responseTier" type="string">
      Response tier: `full`, `interactive`, `minimal`.
    </ParamField>

    <ParamField path="includeWebMCPTools" type="boolean" default="false">
      Include tools discovered via the WebMCP standard.
    </ParamField>

    ```
    observe({ maxElements: 20, responseTier: "interactive", includeScreenshot: true })
    ```
  </Accordion>

  <Accordion title="screenshot">
    Take a screenshot of the current page.

    <ParamField path="fullPage" type="boolean" default="false">
      Capture the entire scrollable page.
    </ParamField>
  </Accordion>

  <Accordion title="aria_snapshot">
    Token-efficient YAML accessibility snapshot. Approximately 80% fewer tokens than `accessibility`.

    No parameters.

    <Tip>
      Prefer `aria_snapshot` over `accessibility` for cost efficiency. Same structure, far fewer tokens.
    </Tip>
  </Accordion>

  <Accordion title="accessibility">
    Full accessibility tree.

    No parameters.
  </Accordion>

  <Accordion title="content">
    Get page text content.

    <ParamField path="format" type="string" default="text">
      Output format: `text` or `markdown`.
    </ParamField>
  </Accordion>

  <Accordion title="element">
    Query element properties: exists, visible, enabled, checked, value.

    <ParamField path="selector" type="string" required>
      Element selector.
    </ParamField>
  </Accordion>
</AccordionGroup>

## AI Agent Methods

<AccordionGroup>
  <Accordion title="act">
    Execute a sequence of browser actions in a single call. Supports fused pre/post observation.

    <ParamField path="steps" type="array" required>
      Array of action steps. Each step has `action`, `selector`, and optionally `value`.

      ```
      steps: [
        { action: "action/fill", selector: "label:Email", value: "user@example.com" },
        { action: "action/click", selector: "role:button:Submit" }
      ]
      ```
    </ParamField>

    <ParamField path="preObserve" type="object">
      Observe page state before executing steps.
    </ParamField>

    <ParamField path="postObserve" type="object">
      Observe page state after executing steps. Contains `maxElements`, `responseTier`.
    </ParamField>

    ```
    act({
      steps: [
        { action: "action/fill", selector: "@e1", value: "user@example.com" },
        { action: "action/fill", selector: "@e2", value: "password123" },
        { action: "action/click", selector: "role:button:Sign in" }
      ],
      postObserve: { responseTier: "interactive" }
    })
    ```
  </Accordion>

  <Accordion title="extract">
    Extract structured data from the page using schema and CSS heuristics.

    <ParamField path="instruction" type="string">
      Natural language description of what to extract.
    </ParamField>

    <ParamField path="mode" type="string">
      Extraction mode: `single` (one object) or `list` (array of objects).
    </ParamField>

    <ParamField path="schema" type="object">
      JSON Schema defining the extraction shape.
    </ParamField>

    ```
    extract({
      instruction: "Extract product listings",
      mode: "list",
      schema: {
        type: "array",
        items: {
          type: "object",
          properties: {
            name: { type: "string" },
            price: { type: "number" }
          }
        }
      }
    })
    ```
  </Accordion>
</AccordionGroup>

## Page Management

<AccordionGroup>
  <Accordion title="pages">
    List all open pages/tabs.

    No parameters.
  </Accordion>

  <Accordion title="activate_page">
    Switch to a different page/tab.

    <ParamField path="pageId" type="string" required>
      Page ID from the `pages` result.
    </ParamField>
  </Accordion>

  <Accordion title="close_page">
    Close the current page/tab.

    No parameters.
  </Accordion>
</AccordionGroup>

## Discovery

<AccordionGroup>
  <Accordion title="discover_tools">
    Discover tools that websites expose via the W3C WebMCP standard. Checks for declarative (form-based) and imperative (navigator.modelContext) tool definitions.

    No parameters.
  </Accordion>
</AccordionGroup>

## Selector Formats

All tools that accept a `selector` parameter support these formats:

```
role:button:Submit        # ARIA role + accessible name (recommended)
text:Sign in              # Visible text content
label:Email address       # Associated label
testid:submit-button      # data-testid attribute
ref:@submitBtn            # Stable element reference from observe
css:.btn-primary          # CSS selector (fallback)
xpath://button[@type]     # XPath selector (fallback)
```

<Warning>
  Always prefer `role:` selectors for buttons, links, and inputs. They survive DOM changes. Never
  copy CSS selectors from browser DevTools.
</Warning>

## Resources

The MCP server also exposes 4 resources:

| Resource                   | Description                 |
| -------------------------- | --------------------------- |
| `bap://page/state`         | Current page URL and title  |
| `bap://page/accessibility` | Full accessibility tree     |
| `bap://page/aria-snapshot` | YAML accessibility snapshot |
| `bap://page/screenshot`    | Current page screenshot     |
