execute_script
Execute custom JavaScript in a live Chrome tab to extract data, manipulate the DOM, or automate workflow steps. Use awaitPromise for async code and set timeouts to control execution.
Instructions
Execute JavaScript in the page context. Must include a return statement. Set awaitPromise=true for async 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": {
"script": "<script>"
},
"name": "execute_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No | Tab ID (optional) | |
| script | Yes | JavaScript code to execute. MUST include "return" statement. | |
| timeoutMs | No | Timeout in milliseconds | |
| awaitPromise | No | Wait for promise to resolve |