browser_evaluate
Evaluates JavaScript in an attached Chrome or Edge tab to extract data or return DOM element references, with optional wait checks and cursor-based cached reads.
Instructions
Evaluate once without user activation; call a returned function once and await its Promise. Completed JSON can be historical (source_current=false) after source change, without a continuation; element refs remain strict. cursor reads cache without execution. Return large collections as a top-level array of small records, not a nested array wrapper; required_chars/next_item guide cursor budgets, capture_truncated is unrecoverable source loss.
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": {
"tab_handle": "<tab_handle>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | Child frame; see shared locator rules. | |
| cursor | No | Exactly one of expression/cursor. Cursor reads cached JSON; omit frame/frame_id and result_type=element. | |
| frame_id | No | ||
| wait_for | No | Post-action checks (same conditions as wait); shares the total action budget. Result is wait_result, never input replay. | |
| max_chars | No | Per-page JSON value budget, excluding metadata; capture cap 1M chars / 50000 nodes / depth 8. | |
| expression | No | ||
| tab_handle | Yes | ||
| timeout_ms | No | ||
| result_type | No | element: return one connected DOM element as a ref. | json |
| dialog_policy | No | ask |