Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/device-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A session is named by its `id` (for example `brave-teal-otter`) in every path. E
|---|---|
| `POST /device/sessions/:id/install` | Install a build: `{ "binaryUploadId": "..." }`, or `{ "url": "https://..." }` for an `.apk` or a zipped simulator `.app` at a link (up to 500 MB). It installs in the background. A command sent meanwhile waits up to 45 s for it, then answers `LIVE_NOT_READY` |
| `POST /device/sessions/:id/launch` | Launch an app: `{ "appId"?: "...", "clearState"?: true }`. Without `appId`, the installed build |
| `POST /device/sessions/:id/actions` | One action: `tap` (`x`/`y` percent, `text` or `id`), `type` (`text`, and `sensitive: true` to keep it secret), `swipe` (`direction`: `up`, `down`, `left` or `right`, or `from`/`to` points in percent), `press_key` (`key`: `back`, `home`, `enter`, `backspace`, `tab`, and on Android `volume_up`, `volume_down`, `lock` or `power`) |
| `POST /device/sessions/:id/actions` | One action: `tap` (`x`/`y` percent, `text` or `id`), `type` (`text`, and `sensitive: true` to keep it secret), `swipe` (`direction`: `up`, `down`, `left` or `right`, or `from`/`to` points in percent), `press_key` (`key`: `back`, `home`, `enter`, `backspace`, `tab`, and on Android `volume_up`, `volume_down`, `lock` or `power`). Answered once the screen has settled. `text` and `id` are matched whole, ignoring case. A `tap` on something that is not on screen waits about 17 s before it fails |
| `POST /device/sessions/:id/run` | Run a Maestro flow, within [what a session runs](#what-a-session-runs): `{ "yaml": "..." }` for one flow, or `{ "flowUploadId": "...", "flow"?: "..." }` for a [flow bundle](#flow-bundles). `env` passes [secrets and variables](#secrets). Waits up to 110 s, or `waitSeconds` (0 to 300), then answers `running` with a `command_id`. A failed run's result includes `screen_text`, the app's visible text after the failure |
| `GET /device/sessions/:id/commands/:commandId` | The status and result of a `run` that answered `running`. `?waitSeconds=` (0 to 300) waits for it to finish instead of answering at once |
| `GET /device/sessions/:id/inspect` | The screen as compact JSON. The on-screen keyboard and the System UI are left out unless you add `?all=true`. Some apps also drop their own fields from the tree while a keyboard is open, and `all` cannot bring them back: hide the keyboard first (`run` with `- hideKeyboard`), then inspect again |
Expand Down
26 changes: 26 additions & 0 deletions cli/dcd-device.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ A typical session:
dcd device start --platform ios --app ./build/MyApp.app --wait
dcd device launch
dcd device inspect
dcd device tap --text "Log in"
dcd device type --text "ann@example.com"
dcd device run flows/login.yaml
dcd device screenshot -o after-login.jpg
dcd device stop
Expand Down Expand Up @@ -97,6 +99,30 @@ While a keyboard is open, some apps report their own fields and buttons with cli

Save a screenshot. `-o <file>` sets where (default `./<session>-<time>.jpg`). With `--json`, `data` gives the file's path.

## `dcd device tap [id]`

Tap one thing on the screen, by exactly one target. Answers once the screen has settled. A target that is not on screen waits about 17 seconds before it fails, so `dcd device inspect` first. A failed tap exits `2`.

| Flag | Description |
|------|-------------|
| `--text <text>` | The element's text, label or hint, matched whole and ignoring case (not a regex) |
| `--rid <id>` | The element's resource id, `rid` in `dcd device inspect` |
| `--x <n> --y <n>` | A point, as percentages of the screen (0 to 100) |

## `dcd device type [id] --text <text>`

Type into the focused field (tap it first). `--sensitive` keeps the text secret: it is stored encrypted, never shown, and masked in the output.

## `dcd device swipe [id] <up|down|left|right>`

Swipe across most of the screen in a direction (`up` scrolls the content up, down the page), or from one point to another with `--from x,y --to x,y`, in percentages.

## `dcd device press-key [id] <key>`

Press a key: `back`, `home`, `enter`, `backspace`, `tab`, and on Android `volume_up`, `volume_down`, `lock` or `power`. `enter` submits the focused field. On Android `back` closes a keyboard or goes back; on iOS it uses the app's own back control when it has one. On iOS, `enter`, `backspace` and `tab` need a focused field.

Each of these sends one [typed action](../api/device-sessions.md). For several steps, an assertion, scrolling until something is visible, or launching an app, use `run`.

## `dcd device run [id] <flow.yaml|directory>`

Run Maestro on the device and wait for the result. A failed flow exits `2`. Maestro's output is printed either way, and after a failure, so is the app's visible text.
Expand Down
4 changes: 2 additions & 2 deletions mcp/agent-devices-skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use the DeviceCloud MCP tools to check app changes on a real iOS simulator or An
1. Call `cheat_sheet` once: it lists the Maestro commands a session runs.
2. `start_device` with the platform (`list_devices` shows the models). Give the user the session's `monitor_url`, where they can watch. A queued session is normal: it starts on its own. Until it is ready, call `get_device_status` with `wait: true`.
3. `install_app`, then `get_device_status` with `wait: true` until the install is done, then `launch_app`.
4. Loop: `inspect_screen` to see what is on screen, then `run` with Maestro commands to act, then `inspect_screen` again. Target elements by their text or id from `inspect_screen`, not by coordinates. Use `take_screenshot` when the layout matters. If the app's own fields are missing from `inspect_screen` while a keyboard is open, hide it (`run` with `- hideKeyboard`) and inspect again.
4. Loop: `inspect_screen` to see what is on screen, then act: `tap_on`, `input_text`, `swipe` or `press_key` for one step (the fastest path), or `run` with Maestro commands for several steps or an assertion, then `inspect_screen` again. Target elements by their text or id from `inspect_screen`, not by coordinates. Use `take_screenshot` when the layout matters. If the app's own fields are missing from `inspect_screen` while a keyboard is open, hide it (`run` with `- hideKeyboard`) and inspect again.
5. If a step needs a person (a 2FA code, a CAPTCHA, a payment sheet), call `request_human` with what they should do, tell the user, and poll `get_human_status` until it is handed back.
6. Always `stop_device` when you are done, even after a failure. A session bills by the minute.

Expand All @@ -37,7 +37,7 @@ description: Check app changes on a real cloud iOS simulator or Android emulator
1. Call `cheat_sheet` once: it lists the Maestro commands a session runs.
2. `start_device` with the platform, and give the user the session's `monitor_url`. A queued session starts on its own: call `get_device_status` with `wait: true` until it is ready.
3. `install_app` (with `app_path` for a local build when using `dcd mcp`), wait with `get_device_status` until it is installed, then `launch_app`.
4. Loop: `inspect_screen`, then `run` with Maestro commands, then `inspect_screen` again. Target elements by text or id, not coordinates. If the app's fields are missing while a keyboard is open, hide it (`- hideKeyboard`) and inspect again.
4. Loop: `inspect_screen`, then `tap_on`, `input_text`, `swipe` or `press_key` for one step, or `run` with Maestro commands for several, then `inspect_screen` again. Target elements by text or id, not coordinates. If the app's fields are missing while a keyboard is open, hide it (`- hideKeyboard`) and inspect again.
5. If a person is needed (2FA, CAPTCHA, payment), call `request_human`, tell the user, and poll `get_human_status` until it is handed back.
6. Always `stop_device` when done, even after a failure.

Expand Down
44 changes: 43 additions & 1 deletion mcp/agent-devices-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,51 @@ Read-only.
|-------|------|----------|-------------|
| `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. |

## `tap_on`

Tap one thing on the screen: an element by its text (txt or a11y from inspect_screen, matched whole and ignoring case, not as a regex), by its id (rid), or a point as x and y percentages of the screen. Give exactly one target. The fastest way to act: it answers once the screen has settled, usually well under a second. A target that is not on screen waits about 17 seconds before it fails, so inspect_screen first. For several steps or an assertion, use run.

| Input | Type | Required | Description |
|-------|------|----------|-------------|
| `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. |
| `text` | string | No | The element's text, label or hint, copied from inspect_screen. |
| `id` | string | No | The element's resource id (rid in inspect_screen). |
| `x` | number, 0 to 100 | No | x as a percentage of the screen, 0 to 100. |
| `y` | number, 0 to 100 | No | y as a percentage of the screen, 0 to 100. |

## `input_text`

Type into the focused field (tap_on the field first). Answers once the screen has settled. With sensitive: true the text is stored encrypted, never shown and masked in the output: use it for passwords and codes.

| Input | Type | Required | Description |
|-------|------|----------|-------------|
| `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. |
| `text` | string | Yes | What to type, as the user would. |
| `sensitive` | boolean | No | The text is a secret: a password, a code. Default false. |

## `swipe`

Swipe across the screen: a direction (up scrolls the content up, i.e. down the page), or from one point to another as x and y percentages. Give either direction, or from and to. Answers once the screen has settled.

| Input | Type | Required | Description |
|-------|------|----------|-------------|
| `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. |
| `direction` | `up`, `down`, `left` or `right` | No | A swipe across most of the screen. |
| `from` | object `{ x, y }` | No | Where the swipe starts, in percentages of the screen. |
| `to` | object `{ x, y }` | No | Where it ends. |

## `press_key`

Press a device key: back, home, enter, backspace, tab, and on Android volume_up, volume_down, lock, power (an iOS simulator has no such buttons). enter submits the focused field; on Android back closes a keyboard or goes back, on iOS it uses the app's own back control when it has one. On iOS enter, backspace and tab need a focused field. Answers once the screen has settled.

| Input | Type | Required | Description |
|-------|------|----------|-------------|
| `session_id` | string | No | The session id from start_device, e.g. "brave-teal-otter". Optional when your organization has exactly one open session. |
| `key` | `back`, `home`, `enter`, `backspace`, `tab`, `volume_up`, `volume_down`, `lock` or `power` | Yes | Which key. |

## `run`

Run a Maestro flow on the device: `yaml` is one flow (a header naming the app, `---`, then commands), run whole. Or `flow_upload_id` runs an uploaded zip of flows (`flow` names the entry file; omitted, all of them run). A device session runs the common Maestro commands and no flow scripts (runScript, evalScript, JavaScript conditions): cheat_sheet lists what it runs. A command it does not run fails the flow before its first step, with its line. Waits up to 110s (wait_seconds changes it); a longer flow answers status "running" with a command_id: call get_command_status with wait: true. A failed run's result has screen_text, the app's visible text after the failure, and failed_at: the file, line and command that failed. See cheat_sheet for syntax.
Run a Maestro flow on the device: `yaml` is one flow (a header naming the app, `---`, then commands), run whole. Or `flow_upload_id` runs an uploaded zip of flows (`flow` names the entry file; omitted, all of them run). For a single tap, swipe, key or typed text prefer tap_on, swipe, press_key and input_text, which are faster; use run for several steps, assertions, scrolling until something is visible, or launching an app. A device session runs the common Maestro commands and no flow scripts (runScript, evalScript, JavaScript conditions): cheat_sheet lists what it runs. A command it does not run fails the flow before its first step, with its line. Waits up to 110s (wait_seconds changes it); a longer flow answers status "running" with a command_id: call get_command_status with wait: true. A failed run's result has screen_text, the app's visible text after the failure, and failed_at: the file, line and command that failed.

| Input | Type | Required | Description |
|-------|------|----------|-------------|
Expand Down
2 changes: 1 addition & 1 deletion mcp/agent-devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Every client you sign in shows up under **Settings → Account → Connected app
1. `list_devices` shows the devices it can start, and any sessions already open.
2. `start_device` leases a device and waits up to a minute for it. If the fleet is busy, the session is queued, which isn't an error: it starts on its own, and the agent waits for it with `get_device_status`.
3. `install_app` installs a build you uploaded, or one at an HTTPS link. `launch_app` starts it.
4. The agent loops: `inspect_screen` to see what's on screen, then `run` to act with Maestro commands, then `inspect_screen` again. `take_screenshot` shows the screen as an image, and `get_logs` reads the app's device log.
4. The agent loops: `inspect_screen` to see what's on screen, then `tap_on`, `input_text`, `swipe` or `press_key` for one step, or `run` for several Maestro commands, then `inspect_screen` again. `take_screenshot` shows the screen as an image, and `get_logs` reads the app's device log.
5. `stop_device` releases the device when it's done.

Every response carries a short **session** block: the session's state, how long it has left, its cost so far, its page in the console, and plain-English warnings, such as an upcoming idle timeout or the app having crashed. The agent never needs a separate call to stay oriented. Agents are told to give you the session's console link as soon as they have it, so you can watch.
Expand Down
3 changes: 2 additions & 1 deletion public/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4078,7 +4078,8 @@ components:
type: object
description: >-
Tap one target: a point (`x` and `y`), an element's `text`, or its `id`. Exactly one. Text and ids are
matched literally, not as regular expressions.
matched whole and ignoring case, literally, not as regular expressions. A target that is not on
screen waits about 17 s before the tap fails.
required: [type]
properties:
type:
Expand Down
Loading