execute_javascript
Runs JavaScript in the current browser page to inspect or manipulate it and returns the script result as text; set async to use await.
Instructions
Execute JavaScript in the current browser page. The return value of the script is returned as text. Set async to true to write code that uses await.
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": {
"session_id": "<session_id>",
"script": "<script>"
},
"name": "execute_javascript"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments available inside the script as the arguments array. | |
| async | No | Wrap the script in an async function (enables await). Default: false. | |
| script | Yes | JavaScript source to run. Use `return` to produce a value. | |
| session_id | Yes | Session ID returned by start_browser. |