Skip to main content
Glama

iph_script

Run JavaScript on a real iPhone to automate multi-step UI flows—loops, conditions, taps, typing, scrolling and waits—in one call without per-step round trips.

Instructions

Run JavaScript that drives the phone, in one call: loops, conditions and several steps without a round trip each. The commands are functions that return what the tool of the same name returns: read(opts), find(selector), tap(target, opts), swipe(direction | {from, to}, opts), pinch(direction | {scale, rotate, at}, opts), scroll(direction, {until, max}), type(text, {clear, submit}), key(name), button(name), launch(app, {restart, arguments, environment}), apps(). Also waitFor(selector, {timeout_ms}), readField({selector, take, regex}) → text, readList({row, columns, group, stop_below, max_scrolls}) → {rows, scrolls, ended}, sleep(ms), log(…), output(key, value). syslog("start" | "read" | "stop" | "status", {app, process, pid, level, after, grep, max}) captures the phone's log as iph_syslog does and returns what it returns; a script cannot write a file. record("start" | "stop" | "status", {display}) records the screen as iph_record does; a script cannot choose the file. tap(target) waits up to 5 s for a selector to appear and hold still; tap([a, b, c]) presses a keypad without re-reading. A call that fails throws an Error with .code, .outcome, .hint and .result (the full result object); uncaught, it ends the script and the result says which call and line. After a call whose outcome is "unknown" the script is stopped and cannot go on. For type(), verified means read back, not text matched; inspect value_changed and warning, never automatically retype. submit withholds Return with unknown / type_not_verified when the effect is uncertain. No files, network or timers; Date, JSON, RegExp, Map and the rest of the language are there. The result has outputs (the returned object, plus output() calls), logs, calls and inputs_sent.

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": {
      "code": "<code>"
    },
    "name": "iph_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoWhat the script reads as `args`.
codeYesJavaScript. The body of a function: `return` ends it and its value becomes `outputs`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full disclosure burden and does so extensively. It documents available functions, error shape (.code, .outcome, .hint, .result), unknown-outcome script stopping, tap wait behavior, type verification semantics, submit uncertainty, no file/network/timer access, syslog and record limitations, and the result structure.

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

Conciseness4/5

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

The description front-loads its purpose and packs in necessary API and behavior detail without obvious filler. The long single paragraph and dense parenthetical command list make it harder to scan, but the content is largely justified for a complex scripting tool.

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?

There are no annotations or output schema, so the description must cover both behavior and return values; it does. It explains the result object (outputs, logs, calls, inputs_sent), error handling, environment limits, and the command surface, making the definition complete for this complexity.

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 description coverage is 100%, and the schema already explains that code is a function body whose return becomes outputs and that args is what the script reads. The description adds substantial meaning beyond the schema by enumerating callable commands, their return values, and execution constraints, though it does not further elaborate args itself.

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?

The description states a specific verb and resource: 'Run JavaScript that drives the phone.' It explains the key value proposition, loops and multi-step logic in one call without round trips, and maps embedded commands to sibling tools such as syslog and record. This clearly distinguishes it from single-command siblings.

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?

It gives a clear implied use case: multi-step scripting with loops, conditions and several steps to avoid per-action round trips. However, it does not explicitly say when to prefer or avoid this tool versus siblings like iph_batch or the individual command tools, so selection still requires inference.

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