Android ui Tree
android_ui_treeDump the active Android window's view hierarchy with node text, resource-id, and bounds, enabling precise control identification and tapping via adb instead of screen-coordinate guessing.
Instructions
Dump the frontmost window's view hierarchy on a connected Android device or emulator (uiautomator over plain adb — no helper to install, identical on emulators and phones): every node's class (as a short type), text, content-desc, resource-id, and bounds in DISPLAY PIXELS. Use this to find a control by identity and tap it with android_tap_element instead of guessing coordinates off a screenshot. Flags are reported only in their interesting state: enabled appears ONLY when the control is disabled, and focused/clickable/scrollable only when true — an absent flag means enabled / not focused / not clickable / not scrollable. The result also carries the display size in pixels so positions can be reasoned about. Output is capped at ~40 KB: when exceeded, the deepest levels are pruned and truncated=true is set — narrow with max_depth or filter in that case. When the returned tree has no labels at all the hint says WHY: the filter matched nothing, the cap dropped the labeled levels, or the screen genuinely exposes no accessibility information (Compose without semantics, Flutter, a WebView, or a game/video surface) — only the last points at android_find_text. Scrolling lists aggregate each item into one row subtree: use android_ui_rows to enumerate them and android_tap_row to operate inside one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Case-insensitive substring matched against a node's text, content-desc, resource-id or type. Matching nodes and their ancestors are kept, everything else is pruned. | |
| serial | No | Target device serial from android_devices (e.g. "emulator-5554" or a USB serial). Defaults to the currently streamed device, else the only connected one. | |
| max_depth | No | Maximum nesting depth to include (0 = the window roots only). Useful to shrink a large hierarchy — Android view trees are commonly 15–30 levels deep because of layout wrappers. |