Skip to main content
Glama

ui_query

Find Android UI controls by role, label, text, semantic key, or region instead of coordinates, and return stable semantic keys to replay actions after layout changes.

Instructions

Find controls by OS-derived semantics instead of coordinates or pixels. Filter by role (button/text_input/toggle/tab/nav_back/nav_close/list_item/search), by label substring, by text substring, by stable semantic_key, or by region. Returns matches with their semantic_key, which stays valid when the layout moves - use it to replay an action on the same control later without storing a tap position.

Input Schema

NameRequiredDescriptionDefault
roleNo
regionNo
max_resultsNo
enabled_onlyNo
semantic_keyNo
text_containsNo
label_containsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden; it partially does so by stating what a match contains (semantic_key) and why the key stays valid across layout moves. However it omits notable runtime behaviors visible in the schema defaults: enabled_only defaults to true, so disabled controls are silently excluded, and max_results defaults to 25, so results are silently truncated — neither is disclosed. It also says nothing about whether the target UI must be in the foreground or what happens on zero matches.

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?

Two sentences, front-loaded with the core mechanism and followed by the payoff (a stable key for replay). Every clause adds information; there is no restatement of the name or filler.

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 an output schema present, return formatting needn't be explained, and the description still usefully says matches carry a semantic_key. For a read-only query tool with seven optional parameters this is nearly sufficient; the residual gap is the undisclosed enabled_only default filter and max_results truncation, which could cause an agent to misinterpret empty or partial results.

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 description coverage is 0%, so the description must compensate, and it largely does: it documents role with the full accepted value set (button/text_input/toggle/tab/nav_back/nav_close/list_item/search), plus label_contains, text_contains, semantic_key, and region as filter modes. Only max_results and enabled_only — two parameters with real behavioral consequences — go unmentioned in both schema and description.

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?

The description opens with a specific verb+resource ("Find controls") and immediately differentiates the mechanism from coordinate/pixel-based lookup, which is the distinction an agent needs when several UI-inspection siblings exist. The enumerated filter dimensions (role, label, text, semantic_key, region) make the scope concrete.

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 gives a clear reason to use it — obtaining a semantic_key that survives layout changes so actions can be replayed later without storing a tap position — but never names or excludes alternatives such as find_elements, get_ui_tree, inspect_view_hierarchy, or element_action, despite many overlapping siblings. Usage is implied by the returned-key benefit rather than stated as when/when-not guidance.

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