Skip to main content
Glama

get_ui_tree

Read-only

Retrieves a simplified flat list of current screen UI elements with coordinates, text, and state, plus optional filters to reduce noise for mobile UI inspection and targeting.

Instructions

Get a simplified flat list of UI elements on the current screen. Each element includes type, text, center coordinates (for tapping), size and state flags. Supports optional filters to reduce noise.

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

Input Schema

NameRequiredDescriptionDefault
platformNoTarget platform. Inferred if omitted.
device_idNoDevice ID. Omit for the connected device.
force_fullNoReturn the tree even when it is identical to the last read. Default: false
type_filterNoOnly return elements whose type contains one of these strings (case-insensitive). E.g. ["Button", "EditText", "TextView"]
max_elementsNoMaximum elements to return; the rest is summarized. Default: 120
only_clickableNoIf true, only return clickable elements. Default: false
only_with_textNoIf true, only return elements with non-empty text. Default: false
dump_timeout_msNoHow long to keep retrying the UI dump on an animating screen. Default: ~5s of progressive backoff
resource_id_containsNoOnly return elements whose resource_id contains this substring (case-insensitive)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

A3.8/5.0
Behavior4/5

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

With readOnlyHint=true already covering the safety profile, the description still adds real value by enumerating what each returned element carries (type, text, center coordinates for tapping, size, state flags) — important since there is no output schema. The note that filters reduce noise also sets expectations about result volume, though it doesn't mention the incremental/dedup behavior implied by force_full or the max_elements summarization.

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?

Three tight sentences with the core action front-loaded, the return payload second, and the filtering capability last. No filler, no restatement of the tool name.

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?

For a nine-parameter read tool with no output schema, the description covers the essential shape of the return value and acknowledges filtering. The gaps — incremental-read semantics and what 'summarized' elements look like when max_elements truncates — are minor because the schema documents the controlling parameters.

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 description coverage is 100%, so every one of the nine parameters is already documented with defaults and constraints in the schema. The description only refers to 'optional filters' generically and adds no syntax, interaction, or precedence detail beyond what the schema states, so 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?

The description opens with a specific verb and resource: 'Get a simplified flat list of UI elements on the current screen,' which tells an agent exactly what comes back (a flat element list, not a screenshot or a hierarchy tree). It does not name or contrast any sibling such as find_element or get_screen_state, so the differentiation from those inspection tools is left implicit.

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?

'Supports optional filters to reduce noise' hints at when the filters matter (noisy screens), but there is no explicit when-to-use versus alternatives guidance, no statement of when to prefer find_element over dumping the tree, and no prerequisites noted. Usage is implied rather than prescribed.

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