Skip to main content
Glama
zifanersuotang

Codex Android MCP

Android ui Tree

android_ui_tree
Read-onlyIdempotent

Dump 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

TableJSON Schema
NameRequiredDescriptionDefault
filterNoCase-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.
serialNoTarget 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_depthNoMaximum 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.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, but the description adds substantial behavioral context: flag reporting semantics (only interesting states), output cap at ~40 KB, truncation behavior, display size in pixels, and the installation-free nature. No contradiction; it enriches the annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Although lengthy, every sentence serves a distinct purpose: purpose, usage, flag semantics, truncation, troubleshooting, and related tools. The purpose is front-loaded, and the structure flows logically from operation to edge cases. Nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers all essential aspects: what the tool returns, how to interpret flags, how to handle truncation, and what to do when no labels are present. Since there is no output schema, this level of detail is necessary and sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema descriptions cover 100% of parameters, establishing a baseline of 3. The description adds value beyond the schema: filter also keeps ancestors, max_depth is contextualized with typical depth (15–30 levels), and serial default behavior is clarified. This justifies a score above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Dump') and resource ('the frontmost window's view hierarchy') and immediately differentiates itself from siblings by mentioning android_tap_element, android_ui_rows, and android_find_text. An agent can clearly understand what this tool does and how it differs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs when to use the tool ('find a control by identity and tap it with android_tap_element') and when to avoid it (if no labels, 'only the last points at android_find_text'). It also directs the agent to android_ui_rows and android_tap_row for scrolling lists, leaving no ambiguity about the decision boundary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zifanersuotang/codex-android-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server