Skip to main content
Glama

ui_tree

Read-only

Extracts the accessibility tree of an Android app's windows, including hidden or unfocused displays, to inspect UI elements, states, and tap coordinates for automation or debugging.

Instructions

The accessibility tree of the windows on an app's display: one line per element with class, text, hint, description, #resource-id, state flags, @center coordinates to tap and bounds, all in display pixels. Works on hidden and unfocused displays. Hides layout-only and off-screen elements unless all_nodes.

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": "ui_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
packageNoApp to act on. An app in its own window or hidden display is found by package; otherwise Waydroid's main display is used.
all_nodesNo
display_idNoAndroid display id instead of a package; 0 is Waydroid's main display.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, and the description adds real behavioral context beyond that: it operates on hidden and unfocused displays, and it suppresses layout-only and off-screen elements unless all_nodes is set. The coordinate/pixel units and the one-line-per-element format also tell the agent what to expect from the result.

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?

The output format is front-loaded in a single dense sentence followed by two short capability clauses; nothing is redundant. It is packed rather than bloated, though the long comma-laden first sentence is harder to scan than a short bulleted enumeration would be.

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

Completeness4/5

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

With no output schema, the description carries the return-format burden and does so by enumerating the per-element fields and pixel units. All three parameters have context (two in schema, all_nodes in the description), so the definition is complete enough to call correctly, with only minor gaps around result size and default display behavior.

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?

The schema already documents package and display_id, and the description adds little for those beyond reinforcing display scoping. Its main contribution is explaining what all_nodes does (unhides layout-only and off-screen elements), which the schema leaves undocumented — meaningful but narrow given 67% coverage.

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 names a concrete resource and output shape: the accessibility tree of windows, one line per element with class, text, hint, resource-id, state flags, tap coordinates and bounds. That is far more specific than the name alone. It does not, however, explicitly distinguish itself from siblings such as screenshot or input, which an agent might reasonably weigh against it.

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 only implied: because it returns @center coordinates to tap, an agent can infer it is the inspection step before input, but the description never says when to prefer it over screenshot or app_info. The note that it works on hidden and unfocused displays is useful context but is a capability statement, not a selection rule.

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