javascript
Run scripts in a browser tab and return the last expression as JSON-able output for debugging and inspecting pages, with DOM access and window.wrappedJSObject for page globals.
Instructions
Run JavaScript in the tab and return the value of the last expression (top-level await works). Runs in the extension's isolated world with full DOM access; reach page globals via window.wrappedJSObject. Return JSON-able values. For debugging and inspection, not for faking user input.
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": "javascript"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| tabId | No | Tab to act on. Defaults to the active tab of the focused Zen window. |