browser
browserAutomate web sessions to open pages, navigate tabs, run Playwright code, inspect DOM snapshots, capture images, and click or type in UI elements for testing and data extraction.
Instructions
Browser sessions with open/close, code, state (AX), snapshot (interactive DOM), navigate, tabs, observe, act, images, dismissSurface and waitForHumanVerification. All except open require browserSessionId. Inspect and attempt ordinary verification through the page UI before requesting human help; pause after bounded attempts fail or user-owned credentials/OTP/QR/device approval are required. Inspect returned postActionState and actual image content. dismissSurface clicks (0,0) for option popups; use explicit Close/Cancel first for dialogs and verify closureConfirmed. action=code executes JavaScript with top-level await in a persistent Node.js Playwright runtime. page, context, browser and tab are already provided: use page directly; never initialize it from window.__page or redeclare these bindings. document, window and DOMParser are unavailable in the outer cell; use them inside a browser-side callback such as page.evaluate. Correct: var info = await page.evaluate(() => ({ title: document.title, url: window.location.href })); nodeRepl.write(info); Incorrect: const page = window.__page; document.querySelector(...). An evaluate callback runs in the page and cannot capture Node variables, page or nodeRepl; pass values using its second argument, return JSON-safe data, then call nodeRepl.write outside the callback. Use nodeRepl.write(value) for results (top-level return is also supported). Prefer var for bindings reused across cells. Bare fetch runs on the Node host without browser cookies; for an observed browser-authenticated HTTP API use context.request.get(url), check response.ok(), then await response.json()/text(). If document/window is not defined, move the DOM read into page.evaluate instead of retrying the same outer-cell code.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "browser"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | ||
| y | No | ||
| key | No | One key or simultaneous chord, e.g. Control+v, Control+Shift+v, Shift+ArrowLeft, Alt+ArrowDown. | |
| url | No | ||
| code | No | action=code executes JavaScript with top-level await in a persistent Node.js Playwright runtime. page, context, browser and tab are already provided: use page directly; never initialize it from window.__page or redeclare these bindings. document, window and DOMParser are unavailable in the outer cell; use them inside a browser-side callback such as page.evaluate. Correct: var info = await page.evaluate(() => ({ title: document.title, url: window.location.href })); nodeRepl.write(info); Incorrect: const page = window.__page; document.querySelector(...). An evaluate callback runs in the page and cannot capture Node variables, page or nodeRepl; pass values using its second argument, return JSON-safe data, then call nodeRepl.write outside the callback. Use nodeRepl.write(value) for results (top-level return is also supported). Prefer var for bindings reused across cells. Bare fetch runs on the Node host without browser cookies; for an observed browser-authenticated HTTP API use context.request.get(url), check response.ok(), then await response.json()/text(). If document/window is not defined, move the DOM read into page.evaluate instead of retrying the same outer-cell code. | |
| endX | No | ||
| endY | No | ||
| kind | No | ||
| text | No | ||
| frame | No | ||
| maxMs | No | ||
| query | No | ||
| scope | No | ||
| steps | No | Intermediate mouse moves for drag/move/hover; drag defaults to 12. | |
| tabId | No | ||
| action | Yes | ||
| button | No | Mouse button for click/drag. Default left. Use right for context menus. | |
| cursor | No | ||
| deltaX | No | ||
| deltaY | No | ||
| reason | No | ||
| imageIds | No | Select historical image IDs; latest image always remains selected. Empty resets history. | |
| question | No | requestUserInput: the complete user-facing question in Markdown. Preserve paragraph breaks; use headings and lists for multiple options or files. Identify the material or decision needed to continue the current task. | |
| selector | No | ||
| modifiers | No | Hold these keys throughout one mouse gesture; release afterwards, including on failure. | |
| clickCount | No | click only: 1 single, 2 double, 3 triple click in one gesture. | |
| snapshotView | No | ||
| tabOperation | No | ||
| observationId | No | ||
| maxOutputChars | No | ||
| recoveryReview | No | ||
| snapshotCursor | No | ||
| observationMode | No | ||
| browserSessionId | No | Required except open. Use the exact id returned by open. | |
| attachmentArtifactIds | No | code only: artifactIds returned by file/code tools. Registers these artifacts for attachmentVault.setInputFiles(locator, artifactId); no local paths. |