tap-agent commands
Every command of tap-agent, the CLI and MCP server an AI agent uses to drive an Android device through the Tap server. Each one lists its options, the MCP tool that does the same, and what it prints.
Experimental: commands and output may change in any release. Generated from the CLI parser for Tap 0.3.0; tap-agent <command> --help prints the same options.
- Targets
-
A ref from the latest
snapshot, such as@e3, orkey=valueterms joined by commas, all of which must match:id=pay,text=Pay,text~=Pay(contains),desc=,hint=,class=,pkg=,index=1.An action needs exactly one matching node. With none or several it is refused before anything is sent to the device.
- Options on every step
-
-s NAMEpicks the session (default$TAP_AGENT_SESSION, elseagent).-d SERIALpicks the device when the session holds several.Steps that act also take
--settle(wait for the screen to stop changing and print what changed),--events KINDS(print the device events seen during the step),--expect KIND[:TEXT](require one, such astoast:saved),--event-timeoutand--expect-death(the step must crash a watched app). - Exit codes
- 0done
- 1the step failed; the reason is on stderr
- 2the command line is wrong
- 3no Tap server is running (
tap start) - 4a watched app crashed or stopped responding during the step
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.
tap-agent 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 [--json] [{unquarantine}] [serial]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), unquarantine(serial)
Examples
tap-agent devices
85e49002 FREE API 29 samsung SM-J810G physical emulator-5554 LEASED API 34 Google sdk_gphone64_x86_64 emulator held by 'agent'
tap-agent devices unquarantine 85e49002
85e49002 is not quarantined; nothing to do
tap-agent attach #
Attach a device to the session (created if needed).
tap-agent attach [--driver-start {auto,cold}] [--idle IDLE]
[--wait-for-device DURATION] [--quarantined] serialserial | — |
--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)
Examples
tap-agent attach emulator-5554
attached emulator-5554 to session 'agent', idle timeout 15m
tap-agent attach 85e49002 --wait-for-device 2m --idle 30m
attached 85e49002 to session 'agent', idle timeout 30m
tap-agent sessions #
List sessions with their devices.
tap-agent sessions [--json]
--json | the SDK connections as JSON |
MCP: sessions(as_json)
Example
tap-agent sessions
agent idle 2s of 15m emulator-5554 ci idle 4m of 15m 85e49002
tap-agent detach #
Detach one device without ending its session.
tap-agent detach
No options of its own.
MCP: detach(device)
Example
tap-agent detach -d 85e49002
detached 85e49002 from session 'agent'
tap-agent release #
End the session and detach its devices.
tap-agent release
No options of its own.
MCP: release()
Example
tap-agent release
released session 'agent' (detached emulator-5554)
tap-agent server-info #
Daemon version, compatibility and configuration.
tap-agent server-info [--json]
--json | structured JSON instead of text |
MCP: server_info(as_json)
Example
tap-agent server-info
daemon version 0.3.0 protocol version 5.3 adb executable adb state dir /home/me/.tap driver available yes defaults action 10, wait 10, lifecycle 30, idle_stable 0.2, acquire 300 api compatibility 2
tap-agent device-info #
The whole device state: display, screen and keyguard, keyboard, conditions, top activity.
tap-agent device-info [--json]
--json | structured JSON instead of text |
MCP: device_info(as_json, device)
Example
tap-agent device-info
api-level 34 model sdk_gphone64_x86_64 display-width 1080 display-height 2400 display-rotation NATURAL current-package com.shop screen-on yes keyguard-locked no keyboard-shown no foreground-activity com.shop/com.shop.CheckoutActivity animations on dark-mode off font-scale 1 density 420 dpi …
tap-agent capabilities #
Read SDK operation support and prerequisites; no device changes.
tap-agent capabilities [--json]
--json | structured capability entries |
MCP: capabilities(as_json, device)
Example
tap-agent capabilities
TAP SUPPORTED Execution-time checks and Android acceptance still apply. DISMISS_KEYGUARD CONDITIONAL Only a keyguard without a PIN, pattern or password can be dismissed. … KEYBOARD_IME_ACTION CONDITIONAL Requires Android API 30; device API 34. … RECORD_AUDIO_PLAYBACK CONDITIONAL Requires Android API 33; device API 34. … …
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.
tap-agent snapshot #
Print the screen, one node per line with its ref.
tap-agent snapshot [-i | --all] [--json] [--package PACKAGE] [--window WINDOW]
[--keyboard {collapse,show,omit}] [--system-bars {collapse,show,omit}]-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)
Examples
tap-agent snapshot
# com.shop · window 1 @e1 [TextView] "Checkout" @e2 [EditText] empty hint="Email" id=email accepts=tap,long-tap,edit @e3 [CheckBox] "Save card" accepts=tap @e4 [Button] "PAY $12.40" id=pay accepts=tap # com.android.systemui · window 2 · status bar (6 nodes, collapsed)
tap-agent snapshot -i --package com.shop
# com.shop · window 1
@e2 [EditText] empty hint="Email" id=email accepts=tap,long-tap,edit
@e3 [CheckBox] "Save card" accepts=tap
@e4 [Button] "PAY $12.40" id=pay accepts=tapaccepts=says what the node takes:tap,long,check,edit,scroll, oractionsfor accessibility actions only (seeaction).- The keyboard and the status and navigation bars collapse to one header line each;
--keyboard showand--system-bars showlist their nodes,omitdrops them, and--window Nshows one window in full.
tap-agent inspect #
Read one node's complete state.
tap-agent inspect [--timeout TIMEOUT] [--json] target
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)
Example
tap-agent inspect @e2
[EditText] empty hint="Email" id=email package com.shop bounds [63,126][1017,244] state enabled clickable long-clickable focusable actions show-on-screen, select, clear-selection, focus
tap-agent exists #
Whether any node matches now.
tap-agent exists [--timeout TIMEOUT] [--json] target
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)
Examples
tap-agent exists text~=Pay
yes
tap-agent exists text=Receipt
no
tap-agent count #
Count matching nodes now.
tap-agent count [--timeout TIMEOUT] [--json] target
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)
Example
tap-agent count class=EditText
2
tap-agent elements #
Read all matching nodes in one bulk read, one line each.
tap-agent elements [--timeout TIMEOUT] [--json] [--texts] target
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)
Examples
tap-agent elements class=EditText
[EditText] "me@example.com" hint="Email" id=email [EditText] empty hint="Card number" id=card
tap-agent elements class=Button --texts
"PAY $12.40" "CANCEL"
tap-agent settle #
Wait for the screen to stop changing, then print what changed.
tap-agent settle [--full] [--package PACKAGE] [--stable-for STABLE_FOR]
[--signal {tree,pixels,all}] [--timeout TIMEOUT]--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)
Examples
tap-agent settle
# com.shop · window 1 + @e6 [TextView] "Paid. Receipt #4471" + @e7 [Button] "DONE" id=done accepts=tap # removed - @e4 [Button] "PAY $12.40" id=pay accepts=tap
tap-agent settle --signal pixels --stable-for 1
(no change)
tap-agent wait #
Wait until a target is visible (or gone, or exactly one node).
tap-agent wait
[--gone | --one | --state {visible,gone,one,enabled,disabled,checked,unchecked,focused,text,text-contains,count} | --until CONDITION]
[--value VALUE] [--timeout TIMEOUT] targettarget | 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)
Examples
tap-agent wait text~=Receipt
text~=Receipt is visible
tap-agent wait text=Loading --gone
text=Loading is gone
tap-agent wait id=pay --state enabled
id=pay is enabled
tap-agent wait id=pay --until enabled=true,text~=Pay
id=pay satisfies enabled=true,text~=Pay
tap-agent activity #
Print the activity on top of the screen (package/class).
tap-agent activity [--json]
--json | package_name and class_name, or null |
MCP: foreground_activity(as_json, device)
Example
tap-agent activity
com.shop/com.shop.CheckoutActivity
tap-agent screenshot #
Save a PNG and print its path.
tap-agent screenshot [-o OUT]
-o, --out OUT | file (default .tap/agent/<serial>-<time>.png) |
MCP: screenshot(device, path)
Example
tap-agent screenshot -o checkout.png
checkout.png
tap-agent 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 [--name NAME] [-o OUT] [--last DURATION | --from TIME]
[--newer-than DURATION | --since TIME] [-L] [--older-than DURATION]
[--all] [--json] [{list,show,clean}] [NAME|ID]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-<serial>[-NAME]-<time>) |
--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)
Examples
tap-agent capture --name checkout-bug
capture checkout-bug saved to .tap/agent/capture-emulator-5554-checkout-bug-20261121-215915-931 .tap/agent/capture-…/emulator-5554.screenshot.png .tap/agent/capture-…/emulator-5554.hierarchy.xml .tap/agent/capture-…/emulator-5554.snapshot.txt .tap/agent/capture-…/emulator-5554.device-info.json .tap/agent/capture-…/emulator-5554.logcat.txt .tap/agent/capture-…/emulator-5554.history.txt …
tap-agent capture list
2026-11-21T19:59:18.401Z checkout-bug emulator-5554 2.6MiB
tap-agent capture clean checkout-bug
cleaned capture checkout-bug (.tap/agent/capture-emulator-5554-checkout-bug-20261121-215915-931)
screenshotsaves only the image andsnapshotsaves nothing;captureis the bundle to attach to a bug.-o DIRmust be a new directory: nothing is overwritten.
tap-agent deaths #
App crashes and ANRs since the device was attached (watched apps; --all for every app).
tap-agent deaths [--package PACKAGE] [--all] [--trace SEQ] [--json] [--wait]
[--timeout TIMEOUT]--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)
Examples
tap-agent deaths
#1 com.shop crashed (pid 23554): java.lang.IllegalStateException: Out of stock
tap-agent deaths --trace 1
com.shop crashed (pid 23554): java.lang.IllegalStateException: Out of stock java.lang.IllegalStateException: Out of stock at com.shop.Cart.pay(Cart.kt:88) at com.shop.CheckoutActivity.onPay(CheckoutActivity.kt:41)
- Any step that makes a watched app crash exits with code 4 and prints the crash under its output.
tap-agent media-record #
Explicit bounded video/audio recording; save bytes privately on stop.
tap-agent media-record [--no-video] [--audio-source {output,playback,mic}]
[--for DURATION] [-o OUT] {start,stop}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)
Examples
tap-agent media-record start --for 20s
recording started
tap-agent media-record stop -o checkout.mp4
saved recording to checkout.mp4
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-agent tap #
Tap a node.
tap-agent tap [--long | --double | --outside-panel] [--allow-reach-below]
[--count COUNT] [--interval INTERVAL] [--duration DURATION]
[--timeout TIMEOUT] targettarget | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: tap(target, long, double, count, interval, duration, timeout, outside_panel, allow_reach_below, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent tap @e4
tapped @e4
tap-agent tap id=pay --settle
tapped id=pay # com.shop · window 1 + @e6 [TextView] "Paid. Receipt #4471" # removed - @e4 [Button] "PAY $12.40" id=pay accepts=tap
tap-agent tap id=save --expect toast:saved
tapped id=save
events:
✓ toast "Card saved" (com.shop)tap-agent tap text=Item --long
long-tapped text=Item
- With
--settlethe step waits for the screen to stop changing and prints the difference:+added,-removed. - A refusal says what to do next, for example
several nodes match; use a ref from snapshot or a narrower selector. Nothing is sent to the device.
tap-agent fill #
Replace a field's text (no key events).
tap-agent fill [--timeout TIMEOUT] [--sensitive] target text
target | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
text | — |
--timeout TIMEOUT | command budget, at most 120s |
--sensitive | a secret: the session log and export never hold the text |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: fill(target, text, timeout_seconds, sensitive, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent fill id=email me@example.com
filled id=email
tap-agent fill id=card 4111111111111111 --sensitive
filled id=card
tap-agent type #
Type into the focused field, or into TARGET after tapping it and waiting for its focus.
tap-agent type [--no-await-focus] [--timeout TIMEOUT]
[--focus-timeout FOCUS_TIMEOUT] [--sensitive] [target] texttarget | 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) |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: type_text(text, target, await_focus, timeout_seconds, focus_timeout_seconds, sensitive, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent type id=email ' extra'
typed 6 characters
tap-agent type 1234
typed 4 characters
- The target comes first, as for
fill:type [TARGET] TEXT; alone, TEXT goes to the focused field.fill TARGET TEXTreplaces the field's text instead.
tap-agent clear #
Clear a field's text.
tap-agent clear [--timeout TIMEOUT] target
target | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: clear(target, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent clear id=email
cleared id=email
tap-agent submit #
Run a focused field's keyboard action (Search, Go, Send, Done, …); API 30+.
tap-agent submit [--timeout TIMEOUT] target
target | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: submit(target, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent submit id=search
submitted id=search
tap-agent action #
List a node's accessibility actions, or perform one as a screen reader does (no touch).
tap-agent action [--timeout TIMEOUT] [--custom] [--json] target [name]
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 |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: accessibility_action(target, name, custom, as_json, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent action @e9
@e9 offers: expand, focus, 'Archive', 'Mark as read'
tap-agent action @e9 expand
performed expand on @e9
tap-agent action @e9 Archive --custom
performed 'Archive' on @e9
- Click is not an action here: use
tap. An action the node does not offer is refused before anything happens.
tap-agent progress #
Set a slider (SeekBar, Slider, RatingBar) to a value in its own units.
tap-agent progress [--timeout TIMEOUT] target value
target | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
value | — |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: set_progress(target, value, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent progress id=volume 40
set progress 40 on id=volume
tap-agent keyboard #
Whether a soft keyboard shows, or hide it.
tap-agent keyboard [--json] [{hide}]action | omit to read whether a soft keyboard shows; one of hide; optional |
--json | read: {"shown": bool} |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: keyboard(action, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent keyboard
keyboard shown
tap-agent keyboard hide
keyboard hidden
hidesends one Back key only when a keyboard shows, then waits up to 2 s for it to go.
Gestures
Gestures run on one node, sized relative to it, never at screen coordinates.
tap-agent scroll #
Scroll a node towards a content edge (down reveals content below).
tap-agent scroll [--timeout TIMEOUT] [--percent PERCENT] target
{up,down,left,right}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 |
--timeout TIMEOUT | command budget, at most 120s |
--percent PERCENT | distance across the node, 1..100; default 80 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: scroll(target, direction, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent scroll id=feed down
scrolled down (finger up) id=feed
tap-agent scroll-until #
Bounded SDK scroll until a descendant target exists.
tap-agent scroll-until [--direction {up,down,left,right}]
[--max-scrolls MAX_SCROLLS] [--percent PERCENT] [--timeout TIMEOUT] target
destinationtarget | 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)
Example
tap-agent scroll-until id=feed text~=Receipt
found text~=Receipt inside id=feed
tap-agent swipe #
Swipe across a node, the finger moving towards --finger.
tap-agent swipe --finger {up,down,left,right} [--timeout TIMEOUT]
[--percent PERCENT] targettarget | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: swipe(target, finger, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent swipe id=card --finger left
swiped finger left id=card
tap-agent fling #
Fling a node towards a content edge, as for scroll; content may keep moving.
tap-agent fling [--timeout TIMEOUT] target {up,down,left,right}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 |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: fling(target, direction, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent fling id=feed down
flung down (finger up) id=feed
tap-agent drag #
Long-press a node, move it onto another node and drop it.
tap-agent drag [--timeout TIMEOUT] target destination
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) |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: drag(target, destination, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent drag text=Milk id=basket
dragged text=Milk onto id=basket
tap-agent pinch #
Pinch a node open (fingers apart, zoom in) or closed.
tap-agent pinch [--percent PERCENT] [--timeout TIMEOUT] target {open,close}target | a ref (@e3), comma-joined selector terms, or a JSON selector (all/any, relations, flags, text modes) |
how | one of open, close |
--percent PERCENT | how far across the node, 1..100 (default 80) |
--timeout TIMEOUT | command budget, at most 120s |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: pinch(target, how, percent, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent pinch id=map open --percent 60
pinched open 60% id=map
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.
tap-agent key #
Press a key: any Android key name (back, home, enter, volume-up, media-play-pause, …) or code:N.
tap-agent key [--list] [--long] [--duration DURATION] [--count COUNT]
[--interval INTERVAL] [name]name | a key name (--list prints them all; 0 .. 9 are the digit keys) or code:N for an Android key code; optional |
--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) |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: press_key(key, list_keys, long, duration, count, interval, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent key back
pressed back
tap-agent key volume-up --count 2
pressed volume-up x2
tap-agent key volume-down --duration 2s
long-pressed volume-down for 2s
tap-agent key power --long
long-pressed power
tap-agent key --list
soft-left 1 soft-right 2 home 3 back 4 …
- As for
tap:--longholds for the device's long-press time,--durationfor a time you give (and implies--long);--count Nrepeats with--intervalbetween presses.
tap-agent panel #
Open the notification shade or quick settings (key back closes it).
tap-agent panel {notifications,quick-settings}name | one of notifications, quick-settings |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: open_panel(panel, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent panel notifications
opened notifications
tap-agent rotate #
Rotate the display and keep it there (auto: back to the sensor).
tap-agent rotate {portrait,landscape,natural,left,upside-down,right,auto}how | one of portrait, landscape, natural, left, upside-down, right, auto |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: rotate(how, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Example
tap-agent rotate landscape
rotated landscape: display landscape, left (2400x1080)
tap-agent screen #
Screen state, or turn it on/off, or wake it and dismiss a keyguard without a PIN.
tap-agent screen [--json] [{on,off,unlock}]action | omit to read the screen and keyguard state; one of on, off, unlock; optional |
--json | read: screen_on, keyguard_locked, keyguard_secure |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: screen(action, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent screen
screen on, keyguard not showing
tap-agent screen unlock
screen on, keyguard not showing
Apps and permissions
app <action> <package> [argument] covers the app lifecycle. permission handles the runtime-permission dialog an app shows, whatever app shows it.
tap-agent 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 [--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]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 |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: app(action, package, argument, any_app, timeout_seconds, as_json, settle, extras, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent app cold-launch com.shop
cold-launched com.shop (pid 4242)
tap-agent app launch com.shop .ui.ItemActivity --extra item:long=42
launched com.shop
tap-agent app grant com.shop android.permission.CAMERA
granted android.permission.CAMERA to com.shop
tap-agent app running com.shop
com.shop is running
tap-agent permission #
List the permission dialog's buttons, or press one.
tap-agent permission [--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}]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 |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: permission(choice, timeout_seconds, accuracy, as_json, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent permission
permission dialog (com.android.permissioncontroller) offers: allow-foreground-only, allow-one-time, deny
tap-agent permission allow-one-time
pressed allow-one-time
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.
tap-agent app-data #
Debuggable-app private files and SQLite bundles; stop the app explicitly first.
tap-agent app-data [--overwrite]
{capabilities,list,read,write,delete,export-db,import-db} package [path]
[local]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)
Examples
tap-agent app-data list com.shop databases
file 20480 "shop.db" file 8192 "shop.db-wal"
tap-agent app-data export-db com.shop shop.db ./shop-db
saved database bundle to ./shop-db (keep database and sidecars together)
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.
tap-agent condition #
Device conditions (animations, dark mode, font scale, density, network switches, languages, stay awake, accessibility display): print or change until release.
tap-agent condition [--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]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)
Examples
tap-agent condition
animations on dark-mode off font-scale 1 density 420 dpi airplane-mode off wifi on mobile-data on locale en-US stay-awake on ime-with-hard-keyboard on high-contrast-text off color-inversion off bold-text off
tap-agent condition locale --json
{
"locale": [
"en-US"
]
}tap-agent condition dark-mode on
dark-mode on (restored on release)
tap-agent location #
Mock the device location until release.
tap-agent location [--accuracy ACCURACY] [--altitude ALTITUDE] latitude
longitudelatitude | -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)
Example
tap-agent location 52.37 4.89
location mocked at 52.37, 4.89 (ends on release)
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.
tap-agent notification #
List the device's notifications, --wait for one, or open or dismiss one (read as data; the shade stays closed).
tap-agent notification [--wait] [--json] [--title TITLE] [--text TEXT]
[--contains] [--package PACKAGE] [--button BUTTON] [--timeout TIMEOUT]
[{open,dismiss}]action | omit to list (or --wait); one of open, dismiss; optional |
--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 |
Also takes the options every step takes: --settle, --events, --expect, --expect-death.
MCP: notification(action, wait, title, text, contains, package, button, as_json, timeout_seconds, settle, expect_death, events, expect_events, event_timeout_seconds, device)
Examples
tap-agent notification
com.shop: 'Order shipped' - 'Arrives Tuesday' [Track, Dismiss] com.android.systemui: 'Virtual SD card' - 'For storing photos, videos, music and more' [Explore, Eject]
tap-agent notification open --title 'Order shipped' --button Track
pressed 'Track' on the notification
tap-agent toast #
Read retained toasts (oldest first, never consumes), or --wait for one.
tap-agent toast [--exact] [--package PACKAGE] [--wait] [--after CURSOR]
[--json] [--timeout TIMEOUT] [text]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)
Examples
tap-agent toast
#1 1795275040120 toast 'Card saved' from 'com.shop' next: --after 6793fef1-…:1
tap-agent toast saved --wait
toast 'Card saved' from com.shop
tap-agent clipboard #
Print the device clipboard, or set it.
tap-agent clipboard [--json] [text]
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)
Examples
tap-agent clipboard SAVE20
clipboard set (6 characters)
tap-agent clipboard
SAVE20
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.
tap-agent push #
Copy a local file to the device until release.
tap-agent push local device_path
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)
Example
tap-agent push ./fixtures/cart.json /sdcard/Download/cart.json
pushed 2048 bytes to /sdcard/Download/cart.json (removed on release)
tap-agent pull #
Copy a device file here and print the local path.
tap-agent pull [-o OUT] device_path
device_path | absolute path of a regular file on the device |
-o, --out OUT | file (default .tap/agent/<serial>-<time>-<name>) |
MCP: pull_file(device_path, out, device)
Example
tap-agent pull /sdcard/Download/receipt.pdf
.tap/agent/out/receipt.pdf
tap-agent media #
Add a photo or video to the device gallery until release.
tap-agent media [--name NAME] local
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)
Example
tap-agent media ./fixtures/receipt.jpg
added /sdcard/Pictures/tap/receipt.jpg to the gallery (removed on 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.
tap-agent 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 [-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]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), history_keep(action, name, long, as_json)
Examples
tap-agent history --last 1m
2026-11-21T19:56:42.242Z emulator-5554 step 93: fill res("email") me@example.com → succeeded
2026-11-21T19:56:51.096Z emulator-5554 step 97: tap res("pay") settle → succeeded
2026-11-21T19:56:51.610Z emulator-5554 CRASH com.shop (pid 23554): java.lang.IllegalStateException: Out of stock
2026-11-21T19:58:56.721Z emulator-5554 step 98: wait res("receipt") → failed (WAIT_TIMEOUT)tap-agent history mark checkout
mark emulator-5554 'checkout' at d01dda20-5b45-4b6e-847b-b51d15b486d5:3959
tap-agent history keep start checkout
keeping 'checkout' (devices attached later join it)
tap-agent history keep stop checkout
stopped keeping 'checkout'
tap-agent history --kept checkout
kept range checkout (stopped)
2026-11-21T19:56:42.242Z emulator-5554 step 93: fill res("email") me@example.com → succeeded
…- A window that ends now (
--last,--last-action) shows the newest page and ends witholder: --after POSITION;--from,--since-markerand--stepread forward. - Missing evidence is never silent: a
GAP:line where capture stopped, or aWARNING:line.
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.
tap-agent 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 [--package PACKAGE] [--for DURATION] [--json]
[--until-first KIND] [--text TEXT] [--timeout TIMEOUT] [KIND ...]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)
Examples
tap-agent watch toast window --for 10s
toast "Card saved" (com.shop) window state com.shop.ReceiptActivity "Receipt" (com.shop)
tap-agent watch --until-first window --package com.shop --timeout 5s
window state com.shop.ReceiptActivity "Receipt" (com.shop)
Agent setup
Register the MCP server with your agent, or give it the CLI with the skill text.
tap-agent mcp #
Run the MCP server on stdio (same sessions as the CLI).
tap-agent mcp
No options of its own.
MCP: none, CLI only.
Example
tap-agent mcp
- Serves MCP on stdin and stdout until the client disconnects. CLI and MCP share sessions and history.
tap-agent skill #
Print the agent skill (SKILL.md).
tap-agent skill
No options of its own.
MCP: none, CLI only.
Example
tap-agent skill
--- name: tap-agent …
No command matches . Try a command name such as tap, an option such as --settle, or a word from a summary such as keyboard.