Skip to main content
Glama

detect_ui_change

Detects UI changes on Android devices after user actions by comparing screen states. Use to verify interactions, wait for transitions, and confirm expected screen updates during automated testing.

Instructions

Polls the UI hierarchy after an action and returns when the screen content changes or the timeout is reached. Returns changed status and elapsed time. By default, omits the XML hierarchy for efficiency — set return_hierarchy=True to receive the full hierarchy.

For efficient change detection: call snapshot_ui before the action, perform the action, then call detect_ui_change with baseline_token. Only use without baseline_token when you need to wait for a slow transition (loading screens, animations). Do not use to read the current screen state — use get_ui_hierarchy for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeout_secondsNoMaximum seconds to poll for a UI change.
baseline_tokenNoToken returned by snapshot_ui, captured before the action. When provided, compares current UI against that snapshot — use this for reliable change detection without loading XML into context. When omitted, captures a fresh baseline at call time.
return_hierarchyNoWhen False (default), returns only changed and elapsed_seconds — no XML. Set to True to include the full UI hierarchy in the response. Only set True when you need to read element data immediately after the change.
device_serialNoAndroid device serial (e.g. 'emulator-5554' or '192.168.1.10:5555'). Omit only when a single device is connected. If the tool returns a multi-device error: STOP. Present the device list to the user verbatim and wait for their explicit choice. Do NOT retry with a guessed or inferred serial — this is a hard requirement. Once the user provides a serial, use it for every subsequent call in this session. To switch devices mid-session, ask the user first.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
changedYes
hierarchyNo
elapsed_secondsYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so effectively. It explains polling behavior, timeout handling, efficiency considerations (omitting XML by default), and the need for device serial management in multi-device scenarios. It doesn't cover rate limits or authentication needs, but provides substantial operational context beyond basic functionality.

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?

The description is perfectly structured and concise. Every sentence earns its place: first sentence states core functionality, second explains efficiency trade-off, third provides usage pattern, fourth specifies alternative use case, and fifth gives exclusion rule. No wasted words, front-loaded with the most important information.

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?

Given the tool's complexity (polling, change detection, device management) and the presence of an output schema (which handles return values), the description is complete. It covers purpose, usage patterns, efficiency considerations, device management requirements, and distinctions from sibling tools, providing all necessary context for an agent to use this tool correctly.

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?

With 100% schema description coverage, the baseline is 3. The description adds some context about parameter usage (e.g., explaining when to use baseline_token vs not, and efficiency implications of return_hierarchy), but doesn't provide significant semantic value beyond what's already documented in the comprehensive schema descriptions.

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 clearly states the tool's purpose with specific verbs ('polls', 'returns when the screen content changes') and resources ('UI hierarchy'), distinguishing it from siblings like get_ui_hierarchy (for reading current state) and snapshot_ui (for capturing baselines). It explicitly defines what the tool does: monitoring UI changes after an action with timeout handling.

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?

The description provides explicit guidance on when to use this tool vs alternatives. It specifies: use with baseline_token for efficient change detection after snapshot_ui, use without baseline_token only for slow transitions, and do not use for reading current screen state (use get_ui_hierarchy instead). This covers both proper usage scenarios and clear exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Neverlow512/agent-droid-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server