eval_js
Execute JavaScript expressions in a specific browser tab and receive the evaluated result as JSON. Ideal for extracting precise values or running custom logic without fetching entire page content.
Instructions
Run a JavaScript expression in a tab and return its value as JSON.
The expression's value is returned, so write document.title, not
return document.title. Promises are awaited on the CDP backend.
Do not use this to dump document.body.innerText — read_tab and
query_dom answer those questions for a fraction of the tokens.
Args: expression: A JavaScript expression. tab_id: Exact tab id. url_pattern: Regex matched against tab URLs. timeout_ms: Per-call timeout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab_id | No | ||
| expression | Yes | ||
| timeout_ms | No | ||
| url_pattern | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |