execute_script
Run synchronous JavaScript in the current page to read multiple values or access page state like localStorage, computed styles, and element counts in one call.
Instructions
Run synchronous JavaScript in the current page and return its result (use a return statement); arguments are available as arguments[0], arguments[1], .... Useful for reading several values in one call, or page state no other tool exposes (localStorage, computed styles, element counts). The script runs with the page's privileges and can change the page; for user actions such as clicking and typing, prefer click and type so real events fire.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | JSON values passed to the script as arguments[0], arguments[1], ... (default none). | |
| script | Yes | JavaScript function body, e.g. 'return document.querySelectorAll(".inventory_item").length;'. Return plain JSON values (strings, numbers, booleans, arrays, objects). |