Evaluate Page JavaScript
browser_evalRun custom JavaScript on the active page to inspect or modify state when standard tools are insufficient. Must acknowledge raw capture and dangerous eval.
Instructions
Use when a full-profile diagnosis cannot be completed with safe DOM, action, wait, or trace tools and exact page-side JavaScript is essential. Preconditions: an active authorized page plus acknowledgeRawCapture: true and acknowledgeDangerousEval: true are required. Next: prefer a targeted inspection tool afterward and document why arbitrary evaluation was necessary. Sensitivity: arbitrary JavaScript can read or modify DOM, storage, page-visible credentials, and remote application state.
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_eval"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arg | No | ||
| maxBytes | No | ||
| frameName | No | ||
| timeoutMs | No | ||
| expression | Yes | ||
| frameUrlContains | No | ||
| acknowledgeRawCapture | No | ||
| acknowledgeDangerousEval | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | ||
| result | No |