safari_evaluate
Execute JavaScript in the current Safari page via AppleScript to run scripts where CSP blocks injection, supporting awaited promises and background-tab fetch/timers.
Instructions
Execute JavaScript in the current page (a returned Promise is awaited — fetch/timers work in background tabs; requestAnimationFrame never fires there). Runs through AppleScript (the extension bridge is off in Daylight), which works where CSP blocks injected scripts (e.g. Google Search Console, LinkedIn). For reading data, prefer safari_read_page or safari_snapshot. For interactions, prefer safari_click/fill with refs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"script": "<script>"
},
"name": "safari_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | Not available in Daylight (the extension bridge is off): a call that passes it is refused. Scripts run in the main document. | |
| script | Yes | JavaScript code to execute | |
| receipt | No | Omit it: Daylight has no tab receipts and refuses a call that passes one |