browser_evaluate
Execute arbitrary JavaScript in the live page to retrieve JSON-serializable data that ARIA snapshots cannot access, such as component state or computed styles.
Instructions
Run an arbitrary JavaScript expression in the page's main frame context. Returns the JSON-serializable result. Escape hatch for when ARIA snapshots cannot introspect something — React/Vue component state, computed styles, custom data attributes, third-party widget internals, hidden DOM the snapshot can't reach. The result must be JSON-serializable and is capped at 10KB. The expression runs in the page's global scope via indirect eval (sees window, document, etc.) and any side effects DO persist — only call this with code you have reviewed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No | Optional tab ID to target. When omitted, routes to the agent's active tab. Use browser_list_tabs to see available tab IDs. | |
| expression | Yes | JavaScript expression to evaluate. The last expression value is returned. Example: `document.querySelector('h1').textContent` or `Array.from(document.querySelectorAll('a')).map(a => a.href)`. |