browser_eval
Execute JavaScript in the page's own context, like DevTools console, to inspect or modify page state and return the result.
Instructions
Runs a JavaScript expression in the PAGE WORLD (its variables and functions, like the DevTools console) and returns the result. The only tool that runs code there: the page can see and tamper with what happens in it. The other tools read and act from an isolated world the page cannot see.
FULL PAGE ACCESS, nothing is masked in the result: the script reads everything the page reads (non-HttpOnly cookies via document.cookie, localStorage, sessionStorage, IndexedDB, form fields, passwords included) and fetch goes out with the user's session. The masking of the other tools (cookies, headers, bodies, passwords) does not apply here: do not read or return any secret the task does not require.
NOT covered by the outward-action accord check (full page access by design): never use it to click, submit or send what browser_click, browser_press_key or browser_type_keys would refuse without the user's accord.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | ||
| tab_id | Yes | Your tab's id (from browser_new_tab, or a tab adopted with browser_adopt_tab). |