browser.eval_js
Execute a JavaScript expression in the current page and return its JSON result; the first call returns approval_required, so retry with approval_id once approved.
Instructions
Execute a JavaScript expression in the current page context and return the result. Every call needs operator approval for that exact expression: the first call returns status approval_required with an approval_id; retry with approval_id once it is approved. Prefer find_elements, get_html or observe for reading the page — they need no approval.
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_js"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | JavaScript expression or function source, evaluated in the page; returns its JSON value. | |
| session_id | No | Target session id, from browser.create_session or browser.list_sessions. Optional when exactly one session is live; observe and act tools create one when none is. | |
| timeout_ms | No | How long to wait for the expression, at most 60000; omitted, 30000. One that times out may still be running in the page. | |
| approval_id | No | ID of the approval granted for exactly this expression. The first call returns status approval_required with an approval_id; call again with it once an operator approves. | |
| workflow_profile | No | governed: a call that can change something waits for approval. It answers status approval_required with an approval_id; call again with that id once it is granted. fast, the default, runs it directly unless this tool or deployment always requires approval. |