browser_evaluate
Execute custom JavaScript in a browser page and retrieve the return value. Use tab ID or index for parallel execution.
Instructions
Execute JavaScript in the page context and return the result.
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": {
"code": "<code>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute. Can return a value. | |
| tab_id | No | Stable tab id from browser_tabs list; preferred when multiple agents run in parallel. Mutually exclusive with tab_index. | |
| tab_index | No | Tab index from browser_tabs list. If omitted, uses the lowest-index tab. Mutually exclusive with tab_id. |