run_js
Execute JavaScript in a shared tab’s own page context to read data missing from the outline or drive page APIs directly, returning the last expression’s result and awaiting promises.
Instructions
Run JavaScript in the page's own context (page globals are visible) and return the result of the last expression, awaited if it is a promise. Works on sites with a strict CSP. Use for reading data the outline does not show or driving page APIs directly.
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": "run_js"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab | No | Tab handle from list_tabs, e.g. "chrome:812". Optional when only one tab is shared. | |
| code | Yes |