javascript
Executes a single expression in a specified browser tab and returns its final value, awaiting promises to extract page data or verify interactions.
Instructions
Run JavaScript in the page and return the value of the last expression (a promise is awaited). Top-level return and await are not allowed: to use await, end with an async function call, e.g. (async () => { const r = await fetch(url); return r.status; })(). Write the code as ONE expression (an arrow function call is fine): some sites forbid eval, and there only a single expression, or statements ending in return, will work.
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": {
"tabId": "<tabId>",
"code": "<code>"
},
"name": "javascript"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| tabId | Yes | Tab ID, from tabs_list or tab_create |