Skip to main content
Glama

safari_evaluate

Execute JavaScript on web pages to automate tasks, with automatic fallback to AppleScript when content security policies block 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?

No annotations provided, so description carries full burden. Adds critical behavioral context about CSP fallback to AppleScript with specific examples (Google Search Console, LinkedIn). However, lacks disclosure about return values, error handling, or whether execution is isolated from page state.

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 with zero waste: primary action + fallback, reading alternative, interaction alternative. Front-loaded with the core capability and immediately distinguishes from siblings.

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?

Given single-parameter input with perfect schema coverage, description appropriately focuses on behavioral quirks (CSP) and sibling differentiation. Missing explicit mention of return values (result of script evaluation), but adequately complete for selection purposes.

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 has 100% coverage describing the 'script' parameter as 'JavaScript code to execute.' Description implies page-context execution but doesn't add syntax constraints, injection risks, or format requirements beyond the schema.

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?

States specific action ('Execute JavaScript') and scope ('in the current page'). The fallback mechanism and explicit comparisons to siblings (safari_read_page, safari_click/fill) clearly distinguish this from 60+ alternative tools.

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?

Provides explicit when-not-to-use guidance: 'For reading data, prefer safari_read_page or safari_snapshot' and 'For interactions, prefer safari_click/fill with refs.' This prevents incorrect tool selection for common use cases.

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