Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code to execute
receiptNoOpaque extension-issued tab receipt — pass the one safari_new_tab returned to keep targeting that tab after an MCP reconnect

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv2.18.1
    • addedInput schema / properties / receipt
      Added value: +{
      +  "description": "Opaque extension-issued tab receipt — pass the one safari_new_tab returned to keep targeting that tab after an MCP reconnect",
      +  "type": "string"
      +}
  2. Addedv2.11.6
  3. Removedv2.11.3
  4. Addedv2.10.9
  5. Removedv2.10.8
  6. Addedv2.10.5
  7. Removedv2.10.4
  8. First observed

TDQS

A4.6/5.0
Behavior5/5

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

No annotations provided, so the description carries full burden. It discloses that a returned Promise is awaited, that fetch/timers work in background tabs but requestAnimationFrame never fires, and that it automatically falls back to AppleScript under CSP restrictions. This is rich, non-obvious behavioral context that an agent needs to predict behavior accurately.

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?

Every sentence earns its place: core action, behavioral quirks, fallback, and routing to alternatives. Well front-loaded with the essential purpose, then efficient supporting details. No filler.

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 the complexity of executing JS (async behavior, fallback, environment quirks), the description covers key aspects. However, it doesn't explicitly state what the tool returns (e.g., the serialized result of the evaluated expression) or how errors are surfaced. With no output schema, this is a minor gap but not critical for correct invocation.

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 description coverage is 100%, so both parameters are already documented in the schema. The description does not add extra meaning about parameter usage beyond the schema, but the baseline 3 is appropriate when the schema fully covers them. No additional semantic value provided.

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 a specific verb and resource: 'Execute JavaScript in the current page' with concrete details about Promise awaiting and background tab behavior. Clearly differentiates from siblings like safari_read_page, safari_snapshot, and 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 tells when to prefer alternatives: 'For reading data, prefer safari_read_page or safari_snapshot. For interactions, prefer safari_click/fill with refs.' Also notes the AppleScript fallback when CSP blocks execution, giving clear context on when this tool is used over others.

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