evaluate_script
Execute a JavaScript function in a Chrome page and return the result as JSON. Use it to extract data, inspect the DOM, or pass element UIDs as arguments.
Instructions
Evaluate a JavaScript function inside the page. Returns the result as JSON.
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": {
"function": "<function>"
},
"name": "evaluate_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Element uids from the latest snapshot, passed as function arguments. | |
| pageId | No | Targets a specific page by ID. Defaults to the selected page. | |
| filePath | No | ||
| function | Yes | A JavaScript function declaration. Example: () => document.title, or (el) => el.innerText | |
| dialogAction | No | "accept", "dismiss", or text for window.prompt. Defaults to accept. | |
| waitForStableDom | No |