Skip to main content
Glama

safari_evaluate

Execute JavaScript in the current browser page, with automatic fallback to AppleScript when Content Security Policy blocks direct execution.

Instructions

Execute JavaScript in the current page. 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

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code to execute
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses the automatic fallback to AppleScript when CSP blocks execution, a valuable behavioral trait. However, does not mention return value, error handling, or potential side effects, though no annotations exist to supplement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each adding value: purpose, fallback behavior, usage guidance. No wasted words; front-loaded with core information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, fallback, and guidance effectively. Lacks mention of return value format, but given no output schema and only one parameter, it is mostly complete for a JS execution tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single parameter 'script', with description 'JavaScript code to execute'. The description adds no additional semantics beyond what the schema provides, so baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it executes JavaScript in the current page, distinguishes from siblings by recommending alternatives for reading (safari_read_page, safari_snapshot) and interactions (safari_click/fill).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly guides when to use (execute JS) and when not to (prefer other tools for reading/interaction). Also mentions automatic fallback to AppleScript when CSP blocks, providing context-specific usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/achiya-automation/safari-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server