Skip to main content
Glama

Inspect Ui Tree

inspect_ui_tree
Read-onlyIdempotent

Inspect a GUI app's semantic accessibility tree to retrieve its functional hierarchy, actionable elements, screen bounds, and process health for automation and testing.

Instructions

Inspects semantic accessibility tree and returns functional hierarchy + 1D interactive nodes.

Includes compact functional component hierarchy, actionable elements, screen bounds, and process health by default. Set include_raw_tree=True only when debugging raw AT-SPI 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": "inspect_ui_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidNo
max_depthNo
include_raw_treeNoInclude the unpruned raw AT-SPI node tree (D-Bus paths, layout wrappers). Defaults to False for a compact functional hierarchy and interactive elements.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive, and closed-world, so safety is covered. The description adds useful behavioral detail about default payload contents (bounds, process health, compact hierarchy) and frames include_raw_tree as a debugging-only, heavier output mode. It omits practical traits such as what happens when pid is null (presumably the focused app), whether accessibility permissions are required, and whether the call is expensive on large trees.

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?

Three short sentences with the core capability front-loaded and the opt-in caveat placed last, which is the right ordering. Minor jargon ('1D interactive nodes') is unexplained, but nothing is padded or redundant.

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?

An output schema exists, so return values need no explanation, and the description covers the default-vs-raw mode distinction adequately. For a 3-parameter tool, the missing semantics for pid and max_depth are the notable remaining gap, especially pid, which determines which application is inspected.

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 only 33% — only include_raw_tree carries a schema description, and the tool description reinforces it with the AT-SPI/debugging rationale. The other two parameters, pid and max_depth, are undocumented in both schema and description, leaving the agent to guess at pid scoping and depth-limit behavior.

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 gives a specific verb (inspects) and resource (semantic accessibility tree) and states what the call returns: a functional component hierarchy plus a flat list of interactive nodes with bounds. This clearly separates it from action siblings like click or interact_with_node, though it never explicitly names a read-only alternative such as watch_ui_events.

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?

It does give one concrete conditional instruction — set include_raw_tree=True only when debugging raw AT-SPI nodes — which is genuine when-to-use guidance for a parameter. However, there is no guidance on when to choose this tool over interacting with nodes or watching events, and no guidance on which pid to pass or when to omit it.

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