Skip to main content
Glama

Read Android UI tree

android_get_ui_tree
Read-onlyIdempotent

Retrieve the current UIAutomator XML hierarchy from an Android device to locate visible UI controls; read-only, with optional ADB serial when multiple devices are connected.

Instructions

Return the current UIAutomator XML hierarchy for locating visible controls. Read-only.

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
deviceNoADB serial. Omit when exactly one device is ready.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.1

TDQS

B3.2/5.0
Behavior2/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint and openWorldHint, so "Read-only." merely restates structured data. The description adds nothing about snapshot staleness, output size, or whether off-screen nodes are included — the traits an agent actually needs beyond the annotations.

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?

Two short sentences, purpose front-loaded, no filler prose. The trailing "Read-only." is redundant with the annotations and is the only wasted token.

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?

With no output schema, the description should say more about the returned XML — its rough structure, size, or whether it covers only visible nodes. "Visible controls" hints at scoping but leaves the return contract underspecified for a tool whose entire job is producing a document.

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?

Only one optional parameter and schema description coverage is 100%, with the schema itself explaining the "omit when exactly one device is ready" behavior. The description contributes no additional meaning, so the baseline 3 applies.

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?

States a specific verb ("Return") and resource ("current UIAutomator XML hierarchy") plus the reason it exists ("for locating visible controls"). It is clearly distinguishable from siblings like android_tap or android_screenshot, though it never explicitly names a contrasting alternative.

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?

The phrase "for locating visible controls" implies when this is appropriate, but there is no explicit when-not, no statement of prerequisites (e.g., app must be in foreground), and no routing to alternatives such as android_screenshot for non-accessible content.

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