Skip to main content

MCP Tools Reference

The BAP MCP server exposes 23 tools organized into six categories. With --slim mode, only 5 essential tools are exposed.
Navigate back in browser history.No parameters.
Navigate forward in browser history.No parameters.
Reload the current page.No parameters.

Element Interaction

Click an element using semantic selectors.
selector
string
required
Element selector (see Selector Formats below).
Fill a form field. Clears existing content first.
selector
string
required
Element selector targeting the input field.
value
string
required
The value to fill.
Type text character by character. First clicks the element, then types. Triggers individual key events.
selector
string
required
Element selector.
text
string
required
Text to type character by character.
delay
number
Delay in milliseconds between keystrokes.
Press keyboard keys (Enter, Tab, shortcuts).
key
string
required
Key to press (e.g., Enter, Tab, Escape, Control+a).
selector
string
Optional element to focus before pressing.
Select an option from a dropdown.
selector
string
required
Element selector targeting the <select> element.
value
string
required
Option value or visible text to select.
Scroll the page or a specific element.
direction
string
default:"down"
Scroll direction: up, down, left, right.
amount
number
default:"300"
Pixels to scroll.
selector
string
Optional element to scroll into view.
Hover over an element.
selector
string
required
Element selector.

Observation

AI-optimized page observation. Returns interactive elements with stable refs. Supports incremental diffs and response tiers.
maxElements
number
default:"50"
Maximum elements to return.
filterRoles
string[]
Filter by ARIA roles (e.g., ["button", "link", "textbox"]).
includeScreenshot
boolean
default:"false"
Include an annotated screenshot with element refs.
incremental
boolean
default:"false"
Return only changes since the last observation: { added, updated, removed }.
responseTier
string
Response tier: full, interactive, minimal.
includeWebMCPTools
boolean
default:"false"
Include tools discovered via the WebMCP standard.
observe({ maxElements: 20, responseTier: "interactive", includeScreenshot: true })
Take a screenshot of the current page.
fullPage
boolean
default:"false"
Capture the entire scrollable page.
Token-efficient YAML accessibility snapshot. Approximately 80% fewer tokens than accessibility.No parameters.
Prefer aria_snapshot over accessibility for cost efficiency. Same structure, far fewer tokens.
Full accessibility tree.No parameters.
Get page text content.
format
string
default:"text"
Output format: text or markdown.
Query element properties: exists, visible, enabled, checked, value.
selector
string
required
Element selector.

AI Agent Methods

Execute a sequence of browser actions in a single call. Supports fused pre/post observation.
steps
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" }
]
preObserve
object
Observe page state before executing steps.
postObserve
object
Observe page state after executing steps. Contains maxElements, responseTier.
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" }
})
Extract structured data from the page using schema and CSS heuristics.
instruction
string
Natural language description of what to extract.
mode
string
Extraction mode: single (one object) or list (array of objects).
schema
object
JSON Schema defining the extraction shape.
extract({
  instruction: "Extract product listings",
  mode: "list",
  schema: {
    type: "array",
    items: {
      type: "object",
      properties: {
        name: { type: "string" },
        price: { type: "number" }
      }
    }
  }
})

Page Management

List all open pages/tabs.No parameters.
Switch to a different page/tab.
pageId
string
required
Page ID from the pages result.
Close the current page/tab.No parameters.

Discovery

Discover tools that websites expose via the W3C WebMCP standard. Checks for declarative (form-based) and imperative (navigator.modelContext) tool definitions.No parameters.

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)
Always prefer role: selectors for buttons, links, and inputs. They survive DOM changes. Never copy CSS selectors from browser DevTools.

Resources

The MCP server also exposes 4 resources:
ResourceDescription
bap://page/stateCurrent page URL and title
bap://page/accessibilityFull accessibility tree
bap://page/aria-snapshotYAML accessibility snapshot
bap://page/screenshotCurrent page screenshot