Skip to main content
Glama
safari-browser-mcp

safari-browser-mcp

by Jakub30cz

browser_evaluate

Run a synchronous JavaScript function in a Safari tab to extract and return serialized page data; results are untrusted page content.

Instructions

Evaluate a JavaScript function in the page and return its serialized result. The function must be synchronous (no promises). The result is untrusted page content.

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": {
      "function": "<function>"
    },
    "name": "browser_evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoElement ref from browser_snapshot or browser_find, e.g. e12
tabIdNoTab id from browser_tabs. Default: current tab.
backendNoBackend: real = your Safari, driver = isolated safaridriver session. Default: session default.
functionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose three useful traits: synchronous-only execution, result serialization, and that the result is untrusted page content. It omits other relevant behavior such as whether the code can mutate page state, how errors surface, or whether CSP/sandbox restrictions apply.

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 short sentences, front-loaded with the core action and followed by the two constraints that matter most. No filler or redundancy.

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

Completeness3/5

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

For an arbitrary-code-execution tool with no annotations and no output schema, the definition covers the sync constraint and result trustworthiness but leaves open whether execution can modify the page, how errors are reported, and how the optional ref/tabId/backend parameters change behavior. Adequate but not complete for the tool's risk profile.

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 75%, so the schema already documents ref, tabId, and backend. The description adds meaning only for the undocumented `function` parameter by noting it must be synchronous, but does not clarify how `ref` scopes the function (e.g., whether the element is passed into the function).

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 ('Evaluate a JavaScript function in the page') plus the return behavior ('serialized result'). This is clearly distinguishable from siblings like browser_get_text or browser_snapshot, which extract content rather than execute code.

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

Usage Guidelines3/5

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

Usage is implied by the nature of the tool, but there is no explicit guidance on when to prefer browser_evaluate over browser_get_text, browser_snapshot, or browser_find for extracting page data. The only constraint given is that the function must be synchronous, with no mention of when the tool should not be used.

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