Skip to main content
Glama

Robot Actions — Remote Device Control

ios_safari_evaluate

Evaluate a JavaScript expression in the context of a Safari page on an iOS device via the Web Inspector. Uses Runtime.evaluate internally. Returns the result as a string (JSON-stringified for objects), followed by a second block naming the tab it actually ran on, read live from that page — check it if a result looks like it came from the wrong page. Omit pageId to auto-pick the frontmost Safari tab. An expression that evaluates to a promise IS awaited, so fetch(...).then(r => r.json()) returns the parsed body rather than an empty object; a promise still pending when the call times out is reported as such instead of being silently returned empty. WAITING: UI frameworks paint a frame or two AFTER the click that triggers them, so an evaluate fired immediately can read the DOM before the menu/overlay/row exists. Use waitForSelector to block until an element appears (and waitMs to let it settle) INSTEAD of splitting the work into a separate poll call — both wait inside this same call on the same tab. DO NOT CLICK WITH THIS TOOL. A click dispatched from JavaScript — .click(), or dispatchEvent of a MouseEvent — is an untrusted event (isTrusted false). Component frameworks and anything gated on a real user gesture (file pickers, clipboard, autoplay, anti-bot checks) may ignore it, so the evaluate SUCCEEDS and the page does nothing — a failure that looks like a passing call. Use webpage_click instead: it has the device tap its own screen at the element, delivering a real trusted touch (pointerdown, touchstart, mousedown, click). Same for typing — webpage_type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYesiOS device UDID
pageIdNoCDP target id from ios_safari_list_pages. Omit it to use the page ios_safari_navigate last landed on (or, failing that, the first loaded page) — only pass it to target a DIFFERENT tab
waitMsNoSettle delay applied just before evaluating (and AFTER waitForSelector matches, when both are given). Use for animations that have started but not finished. Maximum 10000 ms
expressionYesJavaScript expression to evaluate
waitTimeoutMsNoHow long waitForSelector may poll. Default 5000 ms, maximum 15000 ms
platformVersionNoIgnored (kept for compatibility)
waitForSelectorNoCSS selector to wait for BEFORE evaluating. Polls until it matches, then runs the expression. Errors if it never appears within waitTimeoutMs — it will not evaluate anyway and hand back a null that reads like a real answer

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / waitForSelector
      Added value: +{
      +  "description": "CSS selector to wait for BEFORE evaluating. Polls until it matches, then runs the expression. Errors if it never appears within waitTimeoutMs — it will not evaluate anyway and hand back a null that reads like a real answer",
      +  "type": "string"
      +}
    • addedInput schema / properties / waitMs
      Added value: +{
      +  "description": "Settle delay applied just before evaluating (and AFTER waitForSelector matches, when both are given). Use for animations that have started but not finished. Maximum 10000 ms",
      +  "maximum": 10000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / waitTimeoutMs
      Added value: +{
      +  "description": "How long waitForSelector may poll. Default 5000 ms, maximum 15000 ms",
      +  "maximum": 15000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / pageId / description
      Previous value: -"CDP target id from ios_safari_list_pages — auto-picked when omitted"New value: +"CDP target id from ios_safari_list_pages. Omit it to use the page ios_safari_navigate last landed on (or, failing that, the first loaded page) — only pass it to target a DIFFERENT tab"
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

No annotations exist, so the description carries the full behavioral burden, and it pays off: it discloses Runtime.evaluate backing, the string/JSON-stringified return plus a second tab-name block, promise awaiting and timeout reporting, and the untrusted-event pitfall for programmatic clicks. This is unusually rich behavioral disclosure for an evaluate tool.

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?

The description is long but every block earns its place: WAITING and DO NOT CLICK are front-loaded warning sections, and the promise/return details are dense rather than padded. It is appropriately structured for the number of important caveats.

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

Completeness5/5

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

With no output schema and no annotations, the description still provides all essential calling context: return shape, tab targeting, promise/timeout behavior, waiting semantics, and the click/type trap. Nothing critical for safe and correct invocation is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description meaningfully enriches parameters: waitForSelector blocks before evaluating and errors on timeout, waitMs is a settle delay applied after the selector matches, and omitted pageId auto-selects a tab. However, it says 'frontmost Safari tab' while the schema's pageId description says the omitted default is the page ios_safari_navigate last landed on, a minor conflict that prevents a top score.

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?

Opens with a precise verb+resource: 'Evaluate a JavaScript expression in the context of a Safari page on an iOS device via the Web Inspector,' which immediately distinguishes it from web_evaluate and android_devtools_evaluate. It also explicitly warns against using it for clicking, further scoping its purpose.

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 routing: use waitForSelector/waitMs 'INSTEAD of splitting the work into a separate poll call,' and 'DO NOT CLICK WITH THIS TOOL' with 'Use webpage_click instead' plus 'Same for typing — webpage_type.' This tells an agent exactly when to use this tool and when to switch to an alternative.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources