Tap agent command reference¶
Experimental
tap-agent and its export format may change in any release until this notice goes away.
Every tap-agent verb, its arguments and the MCP tool that does the same. The page is
generated from the CLI parser and the MCP server, so it matches tap-agent <verb> --help.
The Tap agent pages explain the flow; this page is for looking
things up. Commands on one page is the same reference with
an example of each command's output and a filter.
Conventions¶
| Term | Meaning |
|---|---|
| Target | A ref from snapshot (@e12), or key=value terms joined by commas, all of which must match. Keys: id, text, text~, desc, desc~, class, hint, pkg, index; boolean flags; text/desc/hint/class/pkg:MODE. ~= means contains. A target matches anywhere on the screen; pkg= keeps it to one app's nodes. |
-s, --session NAME |
The session to use (default $TAP_AGENT_SESSION, else agent). Every verb but mcp and skill takes it. |
-d, --device SERIAL |
Needed only when the session holds several devices. Every verb that runs on a device takes it. |
--settle |
After the step, wait for the screen to stop changing and print the difference (+ added, - removed). |
| Durations | --timeout, --idle, --wait-for-device: 500ms, 10s, 2m, or a number of seconds. |
| Files | screenshot, capture and pull write under .tap/agent/ unless -o says otherwise, and print the path. |
| Exit codes | 0 ok, 1 the step failed (the reason is on stderr), 2 usage, 3 no server running (tap start), 4 a watched app crashed or stopped responding during the step. |
| MCP | Every tool also takes session; tools that run on a device take device. Actions take settle. |
At a glance¶
| Command | What it does | MCP tool |
|---|---|---|
devices |
List devices, properties and who holds them; or unquarantine SERIAL: put a checked quarantined device back in service (retries its cleanup first) | devices |
attach |
Attach a device to the session (created if needed) | attach |
sessions |
List sessions with their devices | sessions |
detach |
Detach one device without ending its session | detach |
release |
End the session and detach its devices | release |
server-info |
Daemon version, compatibility and configuration | server_info |
device-info |
The whole device state: display, screen and keyguard, keyboard, conditions, top activity | device_info |
capabilities |
Read SDK operation support and prerequisites; no device changes | capabilities |
snapshot |
Print the screen, one node per line with its ref | snapshot |
inspect |
Read one node's complete state | inspect |
exists |
Whether any node matches now | exists |
count |
Count matching nodes now | count |
elements |
Read all matching nodes in one bulk read, one line each | elements |
settle |
Wait for the screen to stop changing, then print what changed | settle |
wait |
Wait until a target is visible (or gone, or exactly one node) | wait_for |
activity |
Print the activity on top of the screen (package/class) | foreground_activity |
screenshot |
Save a PNG and print its path | screenshot |
capture |
Save one evidence bundle (the screen, hierarchy, device/driver logs and activity/window state now, and the device's history as text and JSON); or list, show or clean the bundles taken | capture |
deaths |
App crashes and ANRs since the device was attached (watched apps; --all for every app) | deaths |
media-record |
Explicit bounded video/audio recording; save bytes privately on stop | media_record |
tap |
Tap a node | tap |
fill |
Replace a field's text (no key events) | fill |
type |
Type into the focused field, or into TARGET after tapping it and waiting for its focus | type_text |
clear |
Clear a field's text | clear |
submit |
Run a focused field's keyboard action (Search, Go, Send, Done, …); API 30+ | submit |
action |
List a node's accessibility actions, or perform one as a screen reader does (no touch) | accessibility_action |
progress |
Set a slider (SeekBar, Slider, RatingBar) to a value in its own units | set_progress |
keyboard |
Whether a soft keyboard shows, or hide it | keyboard |
scroll |
Scroll a node towards a content edge (down reveals content below) | scroll |
scroll-until |
Bounded SDK scroll until a descendant target exists | scroll_until |
swipe |
Swipe across a node, the finger moving towards --finger | swipe |
fling |
Fling a node towards a content edge, as for scroll; content may keep moving | fling |
drag |
Long-press a node, move it onto another node and drop it | drag |
pinch |
Pinch a node open (fingers apart, zoom in) or closed | pinch |
key |
Press a key: any Android key name (back, home, enter, volume-up, media-play-pause, …) or code:N | press_key |
panel |
Open the notification shade or quick settings (key back closes it) | open_panel |
rotate |
Rotate the display and keep it there (auto: back to the sensor) | rotate |
screen |
Screen state, or turn it on/off, or wake it and dismiss a keyguard without a PIN | screen |
app |
App lifecycle: launch, cold-launch, foreground, background, open-link, stop, clear, install, uninstall, grant, revoke, granted, running, locale, installed, process, visible (visible waits until the app owns the focused window) | app |
permission |
List the permission dialog's buttons, or press one | permission |
app-data |
Debuggable-app private files and SQLite bundles; stop the app explicitly first | app_data |
condition |
Device conditions (animations, dark mode, font scale, density, network switches, languages, stay awake, accessibility display): print or change until release | condition |
location |
Mock the device location until release | set_location |
notification |
List the device's notifications, --wait for one, or open or dismiss one (read as data; the shade stays closed) | notification |
toast |
Read retained toasts (oldest first, never consumes), or --wait for one | toast |
clipboard |
Print the device clipboard, or set it | clipboard |
push |
Copy a local file to the device until release | push_file |
pull |
Copy a device file here and print the local path | pull_file |
media |
Add a photo or video to the device gallery until release | add_media |
history |
What happened: calls, crashes, ANRs and (with --logs) device logs, with this agent's steps; or mark/redact held devices, or keep a named range past retention | history |
watch |
Print device events as they happen, one per line, until stopped (Ctrl-C), --for ends or the device is detached; or --until-first KIND | watch |
mcp |
Run the MCP server on stdio (same sessions as the CLI) | — |
skill |
Print the agent skill (SKILL.md) | — |
Sessions and devices¶
A session is a held connection on the server: it outlives each CLI call, is shared by the CLI and the MCP server, and ends on release or after 15 idle minutes. --session NAME (or TAP_AGENT_SESSION) keeps several apart. A device is held by one session at a time, exactly as a test holds it.
devices¶
List devices, properties and who holds them; or unquarantine SERIAL: put a checked quarantined device back in service (retries its cleanup first).
tap-agent devices [-s SESSION] [--json] [{unquarantine}] [serial]
| Argument | Meaning |
|---|---|
action |
omit to list; one of unquarantine; optional |
serial |
unquarantine: the device's serial; optional |
--json |
list: the devices as JSON, each with held_by |
MCP: devices(as_json): List the devices ADB sees, their state and the session holding each.
MCP: unquarantine(serial): Put a quarantined device back in service, once you (or the user) checked it is in a good state, for example after attaching it with inspect_quarantined and detaching. Retries its cleanup first and says what is still off. Ask the user first when you did not check it.
attach¶
Attach a device to the session (created if needed).
tap-agent attach [-s SESSION] [--driver-start {auto,cold}] [--idle IDLE]
[--wait-for-device DURATION] [--quarantined]
serial
| Argument | Meaning |
|---|---|
serial |
— |
--driver-start DRIVER_START |
cold: start fresh instrumentation; detach an existing attachment first; one of auto, cold; default auto |
--idle IDLE |
end the session after this long unused (default 15m) |
--wait-for-device DURATION |
wait this long for a device another session holds |
--quarantined |
attach a quarantined device to inspect and fix it (it stays quarantined until unquarantine) |
MCP: attach(serial, idle_minutes, wait_for_device_seconds, inspect_quarantined, driver_start): Attach a device with a fresh session, creating the held connection if needed. Call this first.
sessions¶
List sessions with their devices.
tap-agent sessions [-s SESSION] [--json]
| Argument | Meaning |
|---|---|
--json |
the SDK connections as JSON |
MCP: sessions(as_json): List sessions, how long each has been idle, and their devices.
detach¶
Detach one device without ending its session.
tap-agent detach [-s SESSION] [-d DEVICE]
MCP: detach(device): Detach one device, preserving the held session and its other devices.
release¶
End the session and detach its devices.
tap-agent release [-s SESSION]
MCP: release(): End the session and finalize protected capture; history remains available after release.
server-info¶
Daemon version, compatibility and configuration.
tap-agent server-info [-s SESSION] [--json]
| Argument | Meaning |
|---|---|
--json |
structured JSON instead of text |
MCP: server_info(as_json): Daemon version, compatibility and configuration, one line each; never starts it.
device-info¶
The whole device state: display, screen and keyguard, keyboard, conditions, top activity.
tap-agent device-info [-s SESSION] [-d DEVICE] [--json]
| Argument | Meaning |
|---|---|
--json |
structured JSON instead of text |
MCP: device_info(as_json, device): The whole device state, one line each: display, current package, screen and keyguard, keyboard, every condition and the foreground activity.
capabilities¶
Read SDK operation support and prerequisites; no device changes.
tap-agent capabilities [-s SESSION] [-d DEVICE] [--json]
| Argument | Meaning |
|---|---|
--json |
structured capability entries |
MCP: capabilities(as_json, device): Read SDK operation support, blockers and prerequisites, one line each. Never starts an operation, grants permission or changes settings. Support does not guarantee success.
Reading the screen¶
snapshot is the main way to see the screen: text, one node per line, grouped by window, each with a ref (@e12) to act on. A ref names a selector the server found to match exactly that node, and keeps naming it while it stays on screen. Prefer it to screenshot, which an agent has to look at. elements reads a collection, one line per match, in one bulk call, without a diagnostic snapshot; --texts projects raw text. Snapshots and settle append unread historical toasts; toast reads retained toasts without consuming them, and toast --wait waits for one. Gaps/resets are explicit; history is not current UI.
snapshot¶
Print the screen, one node per line with its ref.
tap-agent snapshot [-s SESSION] [-d DEVICE] [-i | --all] [--json]
[--package PACKAGE] [--window WINDOW]
[--keyboard {collapse,show,omit}]
[--system-bars {collapse,show,omit}]
| Argument | Meaning |
|---|---|
-i, --interactive |
interactive controls with descendant context and labeled groups |
--all |
every node, layout containers too |
--json |
the complete structured snapshot with selector candidates; no view level or filter |
--package PACKAGE |
only windows rooted in this package |
--window WINDOW |
only this one-based window ordinal from the snapshot header |
--keyboard KEYBOARD |
the keyboard window: one header line with a count (collapse, the default), its nodes (show), or nothing (omit); one of collapse, show, omit |
--system-bars SYSTEM_BARS |
the status and navigation bars, as --keyboard; the shade and system dialogs always show; one of collapse, show, omit; default collapse |
MCP: snapshot(view, as_json, package, window, keyboard, system_bars, device): The current screen with refs and grouping. context= is descriptive descendant text, not a selector: act on the container's @ref. Filters affect output only, never refs. Unknown window types remain visible. Also delivers and acknowledges unread historical toasts in a separate section; filters do not apply to them. as_json returns the complete structured SDK snapshot plus toast_events metadata.
inspect¶
Read one node's complete state.
tap-agent inspect [-s SESSION] [-d DEVICE] [--timeout TIMEOUT] [--json] target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--timeout TIMEOUT |
read budget, at most 120s |
--json |
structured JSON instead of text |
MCP: inspect(target, timeout_seconds, as_json, device): One node's state: its snapshot line, package, bounds, state, offered actions and range (as_json: the complete SDK element snapshot). Ambiguity remains an error.
exists¶
Whether any node matches now.
tap-agent exists [-s SESSION] [-d DEVICE] [--timeout TIMEOUT] [--json] target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--timeout TIMEOUT |
read budget, at most 120s |
--json |
structured JSON instead of text |
MCP: exists(target, timeout_seconds, as_json, device): Whether any node matches now (yes / no), without waiting or input.
count¶
Count matching nodes now.
tap-agent count [-s SESSION] [-d DEVICE] [--timeout TIMEOUT] [--json] target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--timeout TIMEOUT |
read budget, at most 120s |
--json |
structured JSON instead of text |
MCP: count(target, timeout_seconds, as_json, device): Count matching nodes now, using SDK count semantics.
elements¶
Read all matching nodes in one bulk read, one line each.
tap-agent elements [-s SESSION] [-d DEVICE] [--timeout TIMEOUT] [--json] [--texts]
target
| Argument | Meaning |
|---|---|
target |
written selector with optional pkg and relations; no refs, first or index |
--timeout TIMEOUT |
command budget, at most 120s |
--json |
the SDK snapshots (or texts) as a JSON array |
--texts |
return raw text values instead of element state; preserve nulls and empty strings |
MCP: elements(target, texts, timeout_seconds, as_json, device): All currently exposed matches in one fresh bulk device read, one snapshot-style line each ("no match" if none). Accessibility order, not necessarily visual order; no refs, dump, auto-scroll, implicit wait or atomic-UI guarantee. Staleness/overflow (1000 matches / 1 MiB) fails the whole read, never partial results. Text may be a hint, as in SDK element reads.
settle¶
Wait for the screen to stop changing, then print what changed.
tap-agent settle [-s SESSION] [-d DEVICE] [--full] [--package PACKAGE]
[--stable-for STABLE_FOR] [--signal {tree,pixels,all}]
[--timeout TIMEOUT]
| Argument | Meaning |
|---|---|
--full |
also print unchanged nodes (=) |
--package PACKAGE |
explicit package; otherwise use the focused app |
--stable-for STABLE_FOR |
quiet period, 1ms..30s, no greater than timeout; default 0.5 |
--signal SIGNAL |
what must stop changing; one of tree, pixels, all; default tree |
--timeout TIMEOUT |
at most 120s; default 10s |
MCP: settle(full, timeout_seconds, package, stable_for, signal, device): Wait for the screen to stop changing, then list the snapshot diff and acknowledge unread historical toast observations. Toasts are not current UI state.
wait¶
Wait until a target is visible (or gone, or exactly one node).
tap-agent wait [-s SESSION] [-d DEVICE]
[--gone | --one | --state {visible,gone,one,enabled,disabled,checked,unchecked,focused,text,text-contains,count} | --until CONDITION]
[--value VALUE] [--timeout TIMEOUT]
target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--gone |
— |
--one |
— |
--state STATE |
visibility, state, text, or count condition; one of visible, gone, one, enabled, disabled, checked, unchecked, focused, text, text-contains, count |
--until CONDITION |
until the target's node satisfies CONDITION, in the target grammar: enabled=true,text=Pay or a JSON selector |
--value VALUE |
expected text or count for --state text/text-contains/count |
--timeout TIMEOUT |
at most 120s; default 10s |
MCP: wait_for(target, state, timeout_seconds, value, until, device): Wait for visibility, state, text, count or a condition through SDK waits. Never sends input.
activity¶
Print the activity on top of the screen (package/class).
tap-agent activity [-s SESSION] [-d DEVICE] [--json]
| Argument | Meaning |
|---|---|
--json |
package_name and class_name, or null |
MCP: foreground_activity(as_json, device): The activity on top of the screen as package/class, or that none is resumed (the keyguard shows, or one is starting). Use it to check that a link or a notification opened the right screen.
screenshot¶
Save a PNG and print its path.
tap-agent screenshot [-s SESSION] [-d DEVICE] [-o OUT]
| Argument | Meaning |
|---|---|
-o, --out OUT |
file (default .tap/agent/ |
MCP: screenshot(device, path): A PNG of the screen, also saved to disk. Prefer snapshot: it is text and has refs.
capture¶
Save one evidence bundle (the screen, hierarchy, device/driver logs and activity/window state now, and the device's history as text and JSON); or list, show or clean the bundles taken.
tap-agent capture [-s SESSION] [-d DEVICE] [--name NAME] [-o OUT]
[--last DURATION | --from TIME]
[--newer-than DURATION | --since TIME] [-L] [--older-than DURATION]
[--all] [--json]
[{list,show,clean}] [NAME|ID]
| Argument | Meaning |
|---|---|
action |
omit to take a bundle; list, show NAME|ID or clean NAME|ID manage the ones taken; one of list, show, clean; optional |
NAME|ID |
show/clean: the bundle's name, or its id (as capture list -L shows it); optional |
--name NAME |
taking: label the new bundle (1..80 letters, digits, dots, dashes, underscores) |
-o, --out OUT |
new private directory, never overwrite (default .tap/agent/capture- |
--last DURATION |
taking: only the last DURATION of history (default: all that is kept) |
--from TIME |
taking: history from this ISO time with a time zone |
--newer-than DURATION |
list: bundles taken in the last DURATION |
--since TIME |
list: bundles taken since this ISO time with a time zone |
-L, --long |
list: id, folder, parts and failed parts |
--older-than DURATION |
clean: every bundle taken longer ago than DURATION |
--all |
clean: every bundle |
--json |
list/show: structured JSON instead of text |
MCP: capture(action, name, device, path, last, start, newer_than, since, long, older_than, all_captures, as_json): Save one evidence bundle to a new private directory: the screenshot, hierarchy (and its snapshot outline with refs), device/driver logs and activity/window state now, and the device's history (steps, calls, crashes, ANRs, device log) as history.txt and history.json. Returns its name or id and the paths; a part that fails is listed and the rest are saved. Never a past screen. list, show and clean manage the bundles; clean deletes only files the agent saved.
deaths¶
App crashes and ANRs since the device was attached (watched apps; --all for every app).
tap-agent deaths [-s SESSION] [-d DEVICE] [--package PACKAGE] [--all]
[--trace SEQ] [--json] [--wait] [--timeout TIMEOUT]
| Argument | Meaning |
|---|---|
--package PACKAGE |
only this app's |
--all |
also apps the session did not start or target |
--trace SEQ |
print one death's full stack trace |
--json |
structured entries |
--wait |
block until a watched app dies (exit 4), the session ends or --timeout (exit 0); run it in the background to be told; keeps no idle session alive |
--timeout TIMEOUT |
with --wait: give up after this long (default: until the session ends) |
MCP: deaths(package, all_apps, trace, as_json, device): App crashes and ANRs since the device was attached, oldest first (#sequence, app, exception). Every step already reports new ones after its output; use this to look back, or with trace for one death's full stack trace.
media-record¶
Explicit bounded video/audio recording; save bytes privately on stop.
tap-agent media-record [-s SESSION] [-d DEVICE] [--no-video]
[--audio-source {output,playback,mic}] [--for DURATION] [-o OUT]
{start,stop}
| Argument | Meaning |
|---|---|
action |
one of start, stop |
--no-video |
start: audio only |
--audio-source AUDIO_SOURCE |
start: output mutes speakers; mic captures microphone; one of output, playback, mic |
--for DURATION |
start: stop after this long, whole seconds: 1s..30s with video, 1s..60s audio only |
-o, --out OUT |
stop: additional new output; a private canonical copy is retained |
MCP: media_record(action, video, audio_source, duration_seconds, path, device): Explicit bounded recording of an agent-owned device. Start needs scrcpy; video-only by default, audio needs API 30+. Stop saves SDK-verified bytes privately. Never replay start/stop or relaunch an app on failure. Track/duration options are for start only.
Acting on elements¶
Every action takes a target and needs exactly one matching node: zero is NOT_FOUND, several is AMBIGUOUS, and both fail before anything touches the device. A tap whose point another window covers (a dialog, the shade) fails as NOT_INTERACTABLE / OBSCURED. With --settle, the command then waits for the screen to stop changing and prints what changed, which is usually enough to pick the next step.
tap¶
Tap a node.
tap-agent tap [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--long | --double | --outside-panel] [--allow-reach-below]
[--count COUNT] [--interval INTERVAL] [--duration DURATION]
[--timeout TIMEOUT]
target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--long |
long-press instead |
--double |
double-tap instead |
--outside-panel |
tap outside the dialog, menu, drawer or sheet the target is in |
--allow-reach-below |
with --outside-panel: send the touch even onto the screen under a panel that lets touches through |
--count COUNT |
tap this many times, 1..100; default 1 |
--interval INTERVAL |
release-to-press gap for counted taps, 40ms..1s (default 100ms) |
--duration DURATION |
hold the finger down for this duration, 1ms..30s (implies --long) |
--timeout TIMEOUT |
command budget, at most 120s; must cover the whole gesture |
MCP: tap(target, long, double, count, interval, duration, timeout, outside_panel, allow_reach_below, settle, expect_death, events, expect_events, event_timeout_seconds, device): Tap the one node matching target, or outside the panel it is in.
fill¶
Replace a field's text (no key events).
tap-agent fill [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT] [--sensitive]
target text
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
text |
— |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
--sensitive |
a secret: the session log and export never hold the text |
MCP: fill(target, text, timeout_seconds, sensitive, settle, expect_death, events, expect_events, event_timeout_seconds, device): Replace a field's text (accessibility set-text; no key events).
type¶
Type into the focused field, or into TARGET after tapping it and waiting for its focus.
tap-agent type [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--no-await-focus] [--timeout TIMEOUT] [--focus-timeout FOCUS_TIMEOUT]
[--sensitive]
[target] text
| Argument | Meaning |
|---|---|
target |
optional, first as for fill: a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes); optional |
text |
the characters to type (alone: into the focused field) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--no-await-focus |
with a target: explicitly skip its SDK focus wait |
--timeout TIMEOUT |
per tap/type budget, at most 120s (not an overall deadline) |
--focus-timeout FOCUS_TIMEOUT |
target focus wait budget; SDK default 10s, at most 120s |
--sensitive |
a secret: the session log and export never hold the text |
MCP: type_text(text, target, await_focus, timeout_seconds, focus_timeout_seconds, sensitive, settle, expect_death, events, expect_events, event_timeout_seconds, device): Type into current focus, or tap a target and await its focus through the SDK helper.
clear¶
Clear a field's text.
tap-agent clear [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT]
target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: clear(target, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Clear a field's text.
submit¶
Run a focused field's keyboard action (Search, Go, Send, Done, …); API 30+.
tap-agent submit [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT]
target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: submit(target, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Run a text field's keyboard action (Search, Go, Send, Done, ... as the app set it up), exactly as the keyboard's action key does; press_key enter is not the same. The field must have input focus (tap it first). Android 11 (API 30)+.
action¶
List a node's accessibility actions, or perform one as a screen reader does (no touch).
tap-agent action [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT] [--custom] [--json]
target [name]
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
name |
a standard action (expand, collapse, dismiss, scroll-forward, ...) or, with --custom, a label; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
--custom |
NAME is a custom action's label (e.g. 'Archive') |
--json |
list: actions, custom_actions and range as JSON |
MCP: accessibility_action(target, name, custom, as_json, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Perform an accessibility action on a node as a screen reader does (no touch), or list the actions it offers and its range. Use it for what a node offers instead of a gesture: expand/collapse a section, a list item's custom "Archive"/"Delete". An action the node does not offer fails before anything happens.
progress¶
Set a slider (SeekBar, Slider, RatingBar) to a value in its own units.
tap-agent progress [-s SESSION] [-d DEVICE] [--events KINDS]
[--expect KIND[:TEXT]] [--event-timeout DURATION] [--expect-death]
[--settle] [--timeout TIMEOUT]
target value
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
value |
— |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: set_progress(target, value, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Set a slider (SeekBar, Slider, RatingBar) to an exact value through accessibility ACTION_SET_PROGRESS. A value outside the node's range fails before anything happens.
keyboard¶
Whether a soft keyboard shows, or hide it.
tap-agent keyboard [-s SESSION] [-d DEVICE] [--events KINDS]
[--expect KIND[:TEXT]] [--event-timeout DURATION] [--expect-death]
[--settle] [--json]
[{hide}]
| Argument | Meaning |
|---|---|
action |
omit to read whether a soft keyboard shows; one of hide; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--json |
read: |
MCP: keyboard(action, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device): The soft keyboard: is it showing, or hide it.
Gestures¶
Gestures run on one node, sized relative to it, never at screen coordinates.
scroll¶
Scroll a node towards a content edge (down reveals content below).
tap-agent scroll [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT] [--percent PERCENT]
target {up,down,left,right}
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
direction |
the content to reveal (down: what is below; the finger moves up); one of up, down, left, right |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
--percent PERCENT |
distance across the node, 1..100; default 80 |
MCP: scroll(target, direction, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): One scroll gesture on a scrollable node; down reveals content below.
scroll-until¶
Bounded SDK scroll until a descendant target exists.
tap-agent scroll-until [-s SESSION] [-d DEVICE] [--direction {up,down,left,right}]
[--max-scrolls MAX_SCROLLS] [--percent PERCENT]
[--timeout TIMEOUT]
target destination
| Argument | Meaning |
|---|---|
target |
scroll container: a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
destination |
descendant to find: a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--direction DIRECTION |
one of up, down, left, right; default down |
--max-scrolls MAX_SCROLLS |
1..1000; also bounded by the SDK deadline; default 20 |
--percent PERCENT |
scroll distance, 1..100; default 80 |
--timeout TIMEOUT |
overall SDK loop budget, at most 120s |
MCP: scroll_until(target, destination, direction, max_scrolls, percent, timeout_seconds, device): Bounded SDK container/descendant scroll-until. No movement/end-of-list guarantee; count and deadline bound the loop. Never replay a mutation after transport loss.
swipe¶
Swipe across a node, the finger moving towards --finger.
tap-agent swipe [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle] --finger
{up,down,left,right} [--timeout TIMEOUT] [--percent PERCENT]
target
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--finger FINGER |
where the finger moves (up reveals what is below); one of up, down, left, right |
--timeout TIMEOUT |
command budget, at most 120s |
--percent PERCENT |
distance across the node, 1..100; default 80 |
MCP: swipe(target, finger, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): One swipe across a node, the finger moving towards finger. scroll and fling take the content direction instead (scroll down = finger up).
fling¶
Fling a node towards a content edge, as for scroll; content may keep moving.
tap-agent fling [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT]
target {up,down,left,right}
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
direction |
the content to reveal (down: what is below; the finger moves up); one of up, down, left, right |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: fling(target, direction, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): One fast swipe on a scrollable node towards a content edge, as for scroll; the content may keep moving afterwards (use settle).
drag¶
Long-press a node, move it onto another node and drop it.
tap-agent drag [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--timeout TIMEOUT]
target destination
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
destination |
where to drop it: a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: drag(target, destination, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Long-press the node matching target, move it onto the node matching destination and drop it.
pinch¶
Pinch a node open (fingers apart, zoom in) or closed.
tap-agent pinch [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
[--percent PERCENT] [--timeout TIMEOUT]
target {open,close}
| Argument | Meaning |
|---|---|
target |
a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
how |
one of open, close |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--percent PERCENT |
how far across the node, 1..100 (default 80) |
--timeout TIMEOUT |
command budget, at most 120s |
MCP: pinch(target, how, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): Two-finger pinch on a node (a map, an image).
Keys, system panels and the display¶
Target the shade's and quick settings' nodes with pkg=com.android.systemui; key back closes them (twice from quick settings on newer Android). A rotation is kept until release, which restores the device's own setting.
key¶
Press a key: any Android key name (back, home, enter, volume-up, media-play-pause, …) or code:N.
tap-agent key [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle] [--list] [--long]
[--duration DURATION] [--count COUNT] [--interval INTERVAL]
[name]
| Argument | Meaning |
|---|---|
name |
a key name (--list prints them all; 0 .. 9 are the digit keys) or code:N for an Android key code; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--list |
print every key name with its code (no device needed) |
--long |
hold each press for the device's long-press timeout (Android's long press) |
--duration DURATION |
hold each press this long, 1ms..30s, repeating as a held key does (implies --long) |
--count COUNT |
press this many times, 1..100; default 1 |
--interval INTERVAL |
release-to-press gap for counted presses, 40ms..1s (default 100ms) |
MCP: press_key(key, list_keys, long, duration, count, interval, settle, expect_death, events, expect_events, event_timeout_seconds, device): Press a key, or with list_keys return every key name. What a key does is up to the device and the app in front.
panel¶
Open the notification shade or quick settings (key back closes it).
tap-agent panel [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
{notifications,quick-settings}
| Argument | Meaning |
|---|---|
name |
one of notifications, quick-settings |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
MCP: open_panel(panel, settle, expect_death, events, expect_events, event_timeout_seconds, device): Open a system panel, as a swipe down from the status bar would. Its nodes belong to com.android.systemui (target them with pkg=com.android.systemui); press_key back closes it.
rotate¶
Rotate the display and keep it there (auto: back to the sensor).
tap-agent rotate [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle]
{portrait,landscape,natural,left,upside-down,right,auto}
| Argument | Meaning |
|---|---|
how |
one of portrait, landscape, natural, left, upside-down, right, auto |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
MCP: rotate(how, settle, expect_death, events, expect_events, event_timeout_seconds, device): Rotate the display and keep it there. Returns where the display is afterwards: the app may pin its own orientation. The device's rotation settings are restored on release.
screen¶
Screen state, or turn it on/off, or wake it and dismiss a keyguard without a PIN.
tap-agent screen [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle] [--json]
[{on,off,unlock}]
| Argument | Meaning |
|---|---|
action |
omit to read the screen and keyguard state; one of on, off, unlock; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--json |
read: screen_on, keyguard_locked, keyguard_secure |
MCP: screen(action, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device): Screen power and lock screen. A keyguard with a PIN, pattern or password is never unlocked.
Apps and permissions¶
app <action> <package> [argument] covers the app lifecycle. permission handles the runtime-permission dialog an app shows, whatever app shows it.
app¶
App lifecycle: launch, cold-launch, foreground, background, open-link, stop, clear, install, uninstall, grant, revoke, granted, running, locale, installed, process, visible (visible waits until the app owns the focused window).
tap-agent app [-s SESSION] [-d DEVICE] [--events KINDS] [--expect KIND[:TEXT]]
[--event-timeout DURATION] [--expect-death] [--settle] [--any-app]
[--json] [--timeout TIMEOUT] [--extra KEY[:TYPE]=VALUE]
{launch,cold-launch,foreground,background,open-link,stop,clear,install,uninstall,grant,revoke,granted,running,locale,installed,process,visible}
package [argument]
| Argument | Meaning |
|---|---|
action |
one of launch, cold-launch, foreground, background, open-link, stop, clear, install, uninstall, grant, revoke, granted, running, locale, installed, process, visible |
package |
the app's package name, e.g. com.example.app |
argument |
activity (launch), URI (open-link), APK path (install), permission (grant, revoke, granted) or languages (locale: fr-FR,en or system); optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--any-app |
open-link: let any app handle the link, not only this one |
--json |
reads (granted, running, locale, installed, process): the value as JSON |
--timeout TIMEOUT |
supported lifecycle/visibility/process actions: at most 120s |
--extra KEY[:TYPE]=VALUE |
launch/cold-launch: an intent extra; TYPE is string (default), int, long, float or bool; repeat for more |
MCP: app(action, package, argument, any_app, timeout_seconds, as_json, settle, extras, expect_death, events, expect_events, event_timeout_seconds, device): App lifecycle: launch, cold-launch (force-stop first), foreground (as the launcher would: back where it was), background (home key), open-link (a deep link, restricted to the app unless any_app), stop, clear data, install, uninstall, grant or revoke a runtime permission (revoking stops the app's process), ask whether a permission is granted, whether the app is running, or read or set the app's own languages (locale, API 33+, restored on release); visible waits until the app owns the focused window.
permission¶
List the permission dialog's buttons, or press one.
tap-agent permission [-s SESSION] [-d DEVICE] [--events KINDS]
[--expect KIND[:TEXT]] [--event-timeout DURATION] [--expect-death]
[--settle] [--timeout TIMEOUT] [--accuracy {precise,approximate}]
[--json]
[{allow,allow-foreground-only,allow-one-time,allow-always,allow-selected,allow-all,deny,deny-and-dont-ask-again,keep-foreground-only,keep-one-time}]
| Argument | Meaning |
|---|---|
choice |
the button to press (omit to list them); one of allow, allow-foreground-only, allow-one-time, allow-always, allow-selected, allow-all, deny, deny-and-dont-ask-again, keep-foreground-only, keep-one-time; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--timeout TIMEOUT |
dialog wait/action budget, at most 120s (default 10s) |
--accuracy ACCURACY |
pick Precise or Approximate first (location dialog, Android 12+); one of precise, approximate |
--json |
list: package_name, choices and accuracies |
MCP: permission(choice, timeout_seconds, accuracy, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device): Android's runtime-permission dialog: without a choice, wait for it and list the buttons (and location accuracies) it offers; with one, press that button.
Debuggable app data¶
app-data <action> <package> [path] [local] probes run-as, lists/reads/writes/deletes private files and exports/imports SQLite bundles (database plus WAL/journal, never SHM). Except the probe, stop the app explicitly first. No SQL, root, printed contents, implicit restart or restore on release. Read outputs are owner-only and new; database export needs a new directory. Use --overwrite explicitly for remote replacement. After interrupted import, repair/clear data before launch; do not retry blindly.
app-data¶
Debuggable-app private files and SQLite bundles; stop the app explicitly first.
tap-agent app-data [-s SESSION] [-d DEVICE] [--overwrite]
{capabilities,list,read,write,delete,export-db,import-db} package
[path] [local]
| Argument | Meaning |
|---|---|
action |
one of capabilities, list, read, write, delete, export-db, import-db |
package |
the debuggable app's package name |
path |
relative private path, or database basename; list defaults to root; optional |
local |
read/write: local file; export-db/import-db: local bundle directory; optional |
--overwrite |
write/import-db: explicitly replace existing remote data |
MCP: app_data(action, package, path, local, overwrite, device): Private files/SQLite bundles, never SQL or printed contents. Except capabilities, requires a stopped app: use app stop/relaunch explicitly. Downloads create owner-only files; export needs a new directory. No restore on release. Keep WAL/journal with base database, not SHM. After interrupted import, repair/clear before launch; never retry blindly.
Device conditions and location¶
Everything changed here is restored on release: animations, dark mode, font scale, density, the network switches, the languages and the accessibility display settings, and the mocked location.
condition¶
Device conditions (animations, dark mode, font scale, density, network switches, languages, stay awake, accessibility display): print or change until release.
tap-agent condition [-s SESSION] [-d DEVICE] [--json]
[{animations,dark-mode,font-scale,density,airplane-mode,wifi,mobile-data,locale,stay-awake,ime-with-hard-keyboard,high-contrast-text,color-inversion,bold-text}]
[value]
| Argument | Meaning |
|---|---|
name |
omit to print all; one of animations, dark-mode, font-scale, density, airplane-mode, wifi, mobile-data, locale, stay-awake, ime-with-hard-keyboard, high-contrast-text, color-inversion, bold-text; optional |
value |
animations/dark-mode/airplane-mode/wifi/mobile-data/stay-awake/ime-with-hard-keyboard/high-contrast-text/color-inversion/bold-text: on|off; font-scale: 0.5..2.0; density: dpi or reset; locale: comma-separated BCP-47 tags, e.g. fr-FR,en (omit to print); optional |
--json |
read: an object keyed by name (switches as booleans) |
MCP: condition(name, value, as_json, device): Read the device conditions (animations, dark mode, font scale, display density, airplane mode, Wi-Fi, mobile data, the device languages, stay awake while plugged in, the soft keyboard with a hardware keyboard, high-contrast text, colour inversion, bold text) or change one. A change lasts until release, which restores what the device had, and the result is the value read back. Dark mode and the network switches need API 29+, bold text API 31+; the network switches are real (nothing is mocked).
location¶
Mock the device location until release.
tap-agent location [-s SESSION] [-d DEVICE] [--accuracy ACCURACY]
[--altitude ALTITUDE]
latitude longitude
| Argument | Meaning |
|---|---|
latitude |
-90..90 |
longitude |
-180..180 |
--accuracy ACCURACY |
in meters (default 5) |
--altitude ALTITUDE |
in meters |
MCP: set_location(latitude, longitude, accuracy_m, altitude_m, device): Mock the device location until release (the device's location providers report this fix, and location is turned on if it was off). Call again to move it; release restores the device.
Notifications, toasts and the clipboard¶
Notifications are read as data: the shade stays closed. Toasts are caught when shown in the last 3.5 s or while waiting.
notification¶
List the device's notifications, --wait for one, or open or dismiss one (read as data; the shade stays closed).
tap-agent notification [-s SESSION] [-d DEVICE] [--events KINDS]
[--expect KIND[:TEXT]] [--event-timeout DURATION]
[--expect-death] [--settle] [--wait] [--json] [--title TITLE]
[--text TEXT] [--contains] [--package PACKAGE] [--button BUTTON]
[--timeout TIMEOUT]
[{open,dismiss}]
| Argument | Meaning |
|---|---|
action |
omit to list (or --wait); one of open, dismiss; optional |
--events KINDS |
also print events observed during the step, of these kinds (comma list; toast, window, content, click, scroll, text); not proof of causality or complete capture; repeatable |
--expect KIND[:TEXT] |
require this event to be observed (TEXT: part of it, any case), e.g. toast:saved; unrelated events may match; repeat for several |
--event-timeout DURATION |
how long --expect waits after the step, at most 120s; default 10s |
--expect-death |
the step must make a watched app crash or stop responding (within 10 s after it); a command failing because of it is no failure |
--settle |
wait for the screen to settle, then print what changed |
--wait |
wait until one matches and print it |
--json |
list/--wait: the SDK notifications as JSON |
--title TITLE |
the notification's title |
--text TEXT |
the notification's text |
--contains |
title/text are only part of it |
--package PACKAGE |
only this package's notifications |
--button BUTTON |
open: press the action button with this title instead |
--timeout TIMEOUT |
command/wait budget, at most 120s; default 10s |
MCP: notification(action, wait, title, text, contains, package, button, as_json, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device): The device's notifications as data (the shade stays closed; they never appear in snapshot). open and dismiss need exactly one match. The driver gets notification access for the session.
toast¶
Read retained toasts (oldest first, never consumes), or --wait for one.
tap-agent toast [-s SESSION] [-d DEVICE] [--exact] [--package PACKAGE] [--wait]
[--after CURSOR] [--json] [--timeout TIMEOUT]
[text]
| Argument | Meaning |
|---|---|
text |
part of the toast's text, any case (omit for any toast); optional |
--exact |
text is the whole toast, case included |
--package PACKAGE |
only this package's toasts (default: any app's) |
--wait |
wait for a matching toast (one shown in the last 3.5 s counts) |
--after CURSOR |
read: the toasts after the cursor a previous read printed after next: |
--json |
read: structured observations and cursor metadata |
--timeout TIMEOUT |
with --wait only: at most 120s; default 10s |
MCP: toast(text, exact, package, wait, after, as_json, timeout_seconds, device): Read the last 128 retained toast observations, oldest first (never consumes the inbox), or with wait=true wait for a toast.
clipboard¶
Print the device clipboard, or set it.
tap-agent clipboard [-s SESSION] [-d DEVICE] [--json] [text]
| Argument | Meaning |
|---|---|
text |
put this on the clipboard (omit to print it); optional |
--json |
read: the text as a JSON string |
MCP: clipboard(text, as_json, device): Read the device clipboard as text, or set it.
Files and the gallery¶
The bytes stream through the server. What Tap created on the device is removed on release, and an existing file is never overwritten.
push¶
Copy a local file to the device until release.
tap-agent push [-s SESSION] [-d DEVICE] local device_path
| Argument | Meaning |
|---|---|
local |
the file on this machine |
device_path |
absolute path on the device; its directory must exist (e.g. /sdcard/Download/a.pdf) |
MCP: push_file(local_path, device_path, device): Copy a local file to the device until release. A device file Tap did not push is never overwritten.
pull¶
Copy a device file here and print the local path.
tap-agent pull [-s SESSION] [-d DEVICE] [-o OUT] device_path
| Argument | Meaning |
|---|---|
device_path |
absolute path of a regular file on the device |
-o, --out OUT |
file (default .tap/agent/ |
MCP: pull_file(device_path, out, device): Copy a device file to this machine; returns the local path.
media¶
Add a photo or video to the device gallery until release.
tap-agent media [-s SESSION] [-d DEVICE] [--name NAME] local
| Argument | Meaning |
|---|---|
local |
the image or video on this machine (jpg, png, gif, webp, heic, bmp, mp4, 3gp, webm, mkv, mov) |
--name NAME |
file name on the device (default the local name) |
MCP: add_media(local_path, name, device): Add a photo or video to the device gallery (Pictures/Tap or Movies/Tap, indexed so gallery apps and photo pickers list it) until release.
Turning a session into a test¶
The server keeps every call, crash, ANR and device-log line after release; history shows them with this agent's own steps, page by page, as text or JSON on stdout. history keep start / history keep stop keep a named range past the server's retention; read it with history --kept NAME. See History and kept ranges.
history¶
What happened: calls, crashes, ANRs and (with --logs) device logs, with this agent's steps; or mark/redact held devices, or keep a named range past retention.
tap-agent history [-s SESSION] [-L] [-d SERIAL] [--kept NAME] [--from TIME]
[--last DURATION] [--since-marker NAME] [--step STEP] [--last-action]
[--after POSITION] [--until TIME] [--until-marker NAME] [--logs]
[--package PACKAGES] [--priority PRIORITY] [--tag TAGS]
[--grep REGEX] [--no-actions] [--driver-lines] [--details]
[--limit N] [--json]
[{read,mark,redact,keep}] [value] [name]
| Argument | Meaning |
|---|---|
action |
one of read, mark, redact, keep; optional; default read |
value |
mark NAME, redact REGEX, or keep start|stop|list|clean; optional |
name |
keep start/stop/clean: the kept range's name (or its id, as history keep list -L shows it); optional |
-L, --long |
keep list: state, id, connection, times and disk use |
-d, --device SERIAL |
only these devices (repeatable); for mark/redact, these held devices |
--kept NAME |
only a kept range (history keep start), also after its session ended |
--from TIME |
from this ISO time with a time zone, e.g. 2026-11-21T12:00:00Z |
--last DURATION |
everything in the last DURATION, e.g. 30s or 5m |
--since-marker NAME |
from the newest marker NAME (history mark) |
--step STEP |
one step, by the cursor or id history prints, with its device-log span |
--last-action |
from the start of the newest step |
--after POSITION |
the next page: the position a previous history printed after next: or older: |
--until TIME |
up to this ISO time (excluded) |
--until-marker NAME |
through the newest marker NAME |
--logs |
add the device logs (any log filter below implies it) |
--package PACKAGES |
only this app's log lines (repeatable) |
--priority PRIORITY |
log lines at least this severe: verbose, debug, info, warn, error, fatal |
--tag TAGS |
only log lines with this tag (repeatable) |
--grep REGEX |
only log lines whose message matches (Java regex) |
--no-actions |
leave Tap's own action entries out of the logs |
--driver-lines |
keep the Tap driver's own logcat lines |
--details |
show crash and ANR stack traces |
--limit N |
at most N server entries per page, 1 to 5000 (default 200); a step's calls print as its one line |
--json |
JSON (tap-history/2) instead of text, on stdout; keep list: the kept ranges |
MCP: history(action, value, devices, kept, start, last, since_marker, step, last_action, after, until, until_marker, logs, packages, priority, tags, grep, actions, driver_lines, details, limit, as_json): What happened: calls, crashes, ANRs and gaps (plus device logs with logs or a log filter), with this agent's steps, oldest first; the newest entries without a start. Missing evidence is shown as gaps and warnings. history_keep keeps a named range past the server's retention; read it here with kept="NAME".
MCP: history_keep(action, name, long, as_json): Keep a named range of this session's history past the server's retention policy, devices attached later included (the CLI's history keep). Read it with history kept="NAME", also after the session ended. Not media-record, which records video.
Device events¶
Android reports toasts, window changes, clicks, scrolls, text edits and content changes as they happen. Supported verbs take --events KINDS to print events observed during the step and --expect KIND[:TEXT] to require one (see each verb's options; not scroll-until). Capture is finite and observations do not prove causality. watch KIND --until-first waits for the next one, and watch streams them (run it in the background to be told when something happens). Events are hints: read the screen again before acting on one.
watch¶
Print device events as they happen, one per line, until stopped (Ctrl-C), --for ends or the device is detached; or --until-first KIND.
tap-agent watch [-s SESSION] [-d DEVICE] [--package PACKAGE] [--for DURATION]
[--json] [--until-first KIND] [--text TEXT] [--timeout TIMEOUT]
[KIND ...]
| Argument | Meaning |
|---|---|
KIND |
event kinds, each or comma lists: toast, window, content, click, scroll, text (none with --until-first) |
--package PACKAGE |
only this package's events (default: any app's) |
--for DURATION |
stop after this long (default: until stopped) |
--json |
one JSON object per line |
--until-first KIND |
wait for the first event of this kind from now on, print it and stop (exit 1 on --timeout); one of toast, window, content, click, scroll, text |
--text TEXT |
with --until-first: part of the event's text, any case: a toast's message, a window's title or class, a click's label, an edit's text |
--timeout TIMEOUT |
with --until-first: at most 120s; default 10s |
MCP: watch(kinds, duration_seconds, package, until_first, text, timeout_seconds, device): Collect device events of some kinds for a while (one line each, in order) and return them: what happens on the device with no step of yours, such as a push message or a background sync. With until_first: wait for the next event of one kind and return it; for an event an input step causes, pass expect_events to that step instead (it listens from before it). Read-only.
Agent setup¶
Register the MCP server with your agent, or give it the CLI with the skill text.
mcp¶
Run the MCP server on stdio (same sessions as the CLI).
tap-agent mcp
MCP: none (CLI only).
skill¶
Print the agent skill (SKILL.md).
tap-agent skill
MCP: none (CLI only).