run_js
Execute custom JavaScript in a selected Safari tab and receive the JSON-encoded output, solving cases where dedicated tools do not cover the needed action.
Instructions
Run arbitrary JavaScript in a tab. The escape hatch; prefer the others.
Your code runs as a function body, so return the value you want back. The
result is JSON-encoded, so return plain data rather than DOM nodes.
Args:
tab: Tab index within window 1, or a substring of its URL or title.
code: JavaScript to execute. Use return to produce a result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab | Yes | ||
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |