evaluate
Runs a short JavaScript expression in a Chrome tab, awaits promises, and returns its value; writes large results to a file when an output path is given.
Instructions
Evaluate a short JavaScript expression in a Chrome tab.
Only for small snippets (a few lines): for a longer script, write it to a
file and run it with evaluate_file instead. Awaits promises and
returns the value by value. Returns {"tab_id", "value", "type"} on
success, or {"error": ...} on failure or an uncaught JS exception.
A promise that does not settle within 30 s is reported as an error.
For a large value (e.g. a page's text) pass output_path: an absolute
path (~ is expanded) on the machine running this server. The value is
written there instead of returned — a string as is (UTF-8), anything else
as indented JSON — overwriting any existing file, and the result is
{"tab_id", "path", "type", "bytes"}. On an error the file is not written.
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": {
"expression": "<expression>",
"tab_id": "<tab_id>"
},
"name": "evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab_id | Yes | ||
| expression | Yes | ||
| output_path | No |