Skip to main content
Glama

Read accessibility tree

get_app_state
Read-onlyIdempotent

Read an app's accessibility tree as an indented outline with interactive element IDs for click, type, and other actions. Call before and after UI changes to get valid targets without screenshots.

Instructions

Read an app's accessibility tree as an indented outline in which interactive elements carry ids like [e12] that click, type_text, set_value, scroll, hover and select_text accept. Use it instead of screenshot whenever you intend to act: it is far cheaper in tokens and gives exact targets. Call it before interacting and again after the UI changes, because ids are per-snapshot and a stale id fails. Read-only; it describes the app's visible windows and does not change focus.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesApp name, bundle id, or pid exactly as reported by list_apps, or "frontmost" for the app the user is looking at
queryNoOnly list elements whose role, label or value contains this text (case-insensitive). Ids stay valid. Use it instead of raising max_elements when you know what you are looking for.
max_depthNoMaximum nesting depth to descend (default 18). Lower it for a quick overview of a large window.
max_elementsNoMaximum elements to emit before the outline is truncated (default 800). Prefer `query` over raising this.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.2
    • changedInput schema / properties / app / description
      Previous value: -"App name, bundle id, or pid exactly as reported by list_apps"New value: +"App name, bundle id, or pid exactly as reported by list_apps, or \"frontmost\" for the app the user is looking at"
  2. Changed3 schema fields changedv0.3.1
    • changedInput schema / properties / app / description
      Previous value: -"App name, bundle id, or pid"New value: +"App name, bundle id, or pid exactly as reported by list_apps"
    • changedInput schema / properties / max_depth / description
      Previous value: -"Max tree depth (default 18)"New value: +"Maximum nesting depth to descend (default 18). Lower it for a quick overview of a large window."
    • changedInput schema / properties / max_elements / description
      Previous value: -"Max elements to emit (default 800)"New value: +"Maximum elements to emit before the outline is truncated (default 800). Prefer `query` over raising this."
  3. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already cover readOnly/idempotent/non-destructive, and the description goes well beyond them: it discloses the id format ([e12]), that ids are per-snapshot and stale ids fail, that the output is a token-cheap outline, and that it does not change focus. This is exactly the extra behavioral context annotations cannot carry.

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?

Four tightly packed sentences, front-loaded with what the tool returns, then the screenshot comparison, then the staleness/sequencing rule, then the read-only guarantee. No sentence is filler.

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?

With no output schema, the description carries the burden of explaining the return format (indented outline with [e12] ids) and it does so, plus it covers lifecycle (re-call after UI changes), safety (read-only, no focus change), and cost (token-cheap). Nothing needed to invoke it correctly is missing.

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 coverage is 100%, so the baseline is 3, but the description adds meaning beyond the schema: the [e12] id convention and which sibling tools accept those ids. It does not add much to the query/max_depth/max_elements tradeoff that the schema descriptions already state, so it lands just 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?

States a specific verb and resource ('Read an app's accessibility tree as an indented outline') and immediately distinguishes itself from the screenshot sibling by naming the alternative and the condition that selects this tool. An agent can tell exactly what it gets back and how it differs from the other read tools.

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?

Explicit when-to-use ('Use it instead of screenshot whenever you intend to act'), explicit when-not/alternative, and a sequencing rule ('Call it before interacting and again after the UI changes'). It also names the tools whose parameters consume the returned ids, so the workflow is fully specified.

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