Skip to main content
Glama

await-ui-element

Wait for a UI element to reach an expected state—exists, visible, hidden, or text—and stop polling manually. Use after navigation or before interacting with asynchronous elements.

Instructions

Block until a UI element reaches an expected state or a timeout elapses, so you don't have to poll screenshot/describe yourself.

Conditions: exists — the selector matches an element anywhere in the tree. visible — the selector matches an element with a non-zero on-screen frame. hidden — the selector matches nothing, or only a zero-area element (e.g. a spinner that disappeared). text — the FIRST match in reading order (topmost, then leftmost) contains expectedText (case-insensitive substring). A loose selector can match several elements; only that topmost one is inspected, so if a lower match is the one holding the text the wait still reports failure — narrow the selector to target it.

The selector is { text?, identifier?, role? }; every provided field must match (case-insensitive substring). text matches the element's label or value. It polls the same accessibility / DOM tree as describe (iOS AXRuntime, Android uiautomator, Chromium CDP) every pollIntervalMs (default 400ms) until timeoutMs (default 5000ms).

Returns { success: boolean, elapsed: number } — success=false means the condition never held before the timeout (a note then explains what was seen). Use this after a tap/navigation to wait for the next screen, or before tapping an element that appears asynchronously.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYesTarget device id from `list-devices` (iOS UDID, Android serial, or Chromium id).
bundleIdNoOptional iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on Android / Chromium.
selectorYesElement to match (text / identifier / role).
conditionYesWhat to wait for. `exists`: selector is anywhere in the tree. `visible`: selector is present with a non-zero on-screen frame. `hidden`: selector is absent or zero-area. `text`: the first match in reading order (topmost) contains expectedText — if a loose selector hits several elements, only that topmost one is checked, so narrow it to target the intended element.
timeoutMsNoMax time to wait for the condition before giving up (default 5000).
expectedTextNoFor condition `text`: case-insensitive substring the first matched element (topmost in reading order) must contain.
pollIntervalMsNoHow often to re-check the tree (default 400).
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It details polling behavior (pollIntervalMs, timeoutMs), the accessibility/DOM tree sources, condition semantics (e.g., the text condition nuance about reading order), and return value. This is highly transparent.

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?

The description is relatively long but well-structured with bullet points and clear sections. Every sentence adds information; no fluff. It could be slightly shorter but is appropriately detailed.

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 complexity (7 parameters, nested object, no output schema), the description covers all necessary aspects: purpose, conditions, selector rules, polling details, return value, and use cases. It is fully complete for an agent to invoke correctly.

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 100%, so baseline is 3. The description adds value by elaborating on each parameter: e.g., for condition it explains each enum value, for selector fields it notes case-insensitive substring matching, and for expectedText it clarifies the reading-order rule.

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: 'Block until a UI element reaches an expected state or a timeout elapses'. It lists four distinct conditions (exists, visible, hidden, text) and explains the utility, distinguishing it from polling via screenshot/describe.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'Use this after a tap/navigation to wait for the next screen, or before tapping an element that appears asynchronously'. It does not explicitly list alternatives or when not to use, but the provided context is sufficient.

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/software-mansion/argent'

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