evaluate
Run JavaScript in a Chrome tab to inspect or manipulate page elements, await promises, and return JSON results or page errors.
Instructions
Run JavaScript in the page. script is an expression or a function source; a function is called with the target element (or no argument). Promises are awaited. The result is JSON (truncated); DOM elements are rendered as snapshot lines with refs. Page exceptions are returned as errors.
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": {
"script": "<script>"
},
"name": "evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab | No | Tab id such as "t3"; default is the active tab | |
| script | Yes | ||
| target | No |