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
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | What the script reads as `args`. | |
| code | Yes | JavaScript. The body of a function: `return` ends it and its value becomes `outputs`. |