Skip to main content
Glama

android_get_ui_tree

Reads interactive Android UI elements from the live Shadow DOM stream or uiautomator XML fallback, enabling deterministic automation to inspect the current screen hierarchy without screenshots.

Instructions

Reads interactive Android UI elements from the sub-millisecond Kotlin Shadow DOM stream (falls back to uiautomator XML if daemon stream is cold).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "android_get_ui_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
device_serialNoOptional ADB device serial. Defaults to the first connected device.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are present, so the description carries the whole burden and it does disclose the data source (Kotlin Shadow DOM stream), a latency claim, and a fallback path to uiautomator XML. It omits what "interactive" filters out, whether it blocks until the daemon warms up, and what happens on failure.

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

Conciseness4/5

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

One sentence, front-loaded with the core read action, with the fallback parenthetical kept brief. It is dense with internal jargon ("Kotlin Shadow DOM stream") that costs some readability but no sentence is wasted.

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

Completeness3/5

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

There is no output schema, so the description is the only place an agent could learn the shape of returned nodes (identifiers, bounds, text, hierarchy), and it says nothing about that. For a tool whose whole value is the returned tree, this leaves a meaningful gap despite the otherwise adequate framing.

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

Parameters3/5

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

Schema coverage is 100% and the single device_serial parameter already documents its default-to-first-device behavior, so the schema does the heavy lifting. The description adds no device-selection semantics beyond what the schema states.

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

Purpose4/5

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

The description supplies a specific verb+resource ("Reads interactive Android UI elements") and implies scope via "interactive," which separates it from the sibling action tools like android_tap_element and android_swipe. It stops short of an explicit contrast with siblings such as android_graph_stats or android_navigate_to_node.

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

Usage Guidelines3/5

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

Usage is implied by the name and the read-only nature of the sentence, and the fallback clause hints at a reliability condition. There is no explicit statement of when to prefer this tool over the action siblings or what prerequisites (daemon running, device connected) apply.

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