browser_evaluate
Runs JavaScript in a browser tab and returns JSON results, enabling custom DOM extraction or page-state checks with top-level await support.
Instructions
Run JavaScript in the page and return the JSON result. Supports top-level await. Example: "document.querySelectorAll('a').length". Not available when the extension was installed from the Chrome Web Store (browser_status shows evaluateAvailable); prefer the other tools.
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": {
"expression": "<expression>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No | Tab to act on. Defaults to the tab last opened/selected by an agent, else the active tab. | |
| expression | Yes |