safari_evaluate
Run custom JavaScript in the current page, including async operations, with automatic AppleScript fallback when Content Security Policy blocks execution.
Instructions
Execute JavaScript in the current page (a returned Promise is awaited — fetch/timers work in background tabs; requestAnimationFrame never fires there). Automatically falls back to AppleScript when CSP blocks execution (e.g. Google Search Console, LinkedIn). For reading data, prefer safari_read_page or safari_snapshot. For interactions, prefer safari_click/fill with refs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | JavaScript code to execute | |
| receipt | No | Opaque extension-issued tab receipt — pass the one safari_new_tab returned to keep targeting that tab after an MCP reconnect |