eval
Run JavaScript in the target browser page and return JSON results, scoped to an element by ref or role/name; use return for multi-statement code to inspect or alter live tabs.
Instructions
Run JavaScript in the page and return the JSON result. With ref, el is that element. Use return for multi-statement code.
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": "eval"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | ||
| ref | No | Element ref from the latest snapshot, e.g. e12 or f1e5 | |
| tab | No | Tab id. Default: your own target tab (each agent session gets its own) | |
| code | Yes | ||
| find | No | Instead of ref: the role and name as the snapshot shows them, e.g. {role:"button", name:"Save"}; nth:2 picks the second match. Survives reloads and new sessions, so recipes use it | |
| browser | No | chrome, edge, ... (only when several browsers are connected) |