Skip to main content
Glama

await-ui-element

Block until a UI element reaches an expected state (exists, visible, hidden, or contains text) or a timeout elapses, so you don't have to poll manually.

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 VISIBLE match in reading order (topmost, then leftmost; falling back to the first match overall if none is visible) contains expectedText (case-insensitive substring), or exactly matches it when textMatch is equals. A loose selector can match several elements; only that one is inspected, so if a different 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. text and role match as case-insensitive substrings of the element's label/value and role; identifier matches exactly (case-insensitive), also accepting the unqualified Android resource-id name ('submit' matches 'com.example.app:id/submit'). It polls the same accessibility / DOM tree as describe (iOS AXRuntime, Android uiautomator, Chromium CDP, Vega automation toolkit) 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 visible match in reading order (topmost), falling back to the first match overall if none is visible, contains (or, with textMatch `equals`, exactly matches) expectedText — if a loose selector hits several elements, only that one is checked, so narrow it to target the intended element.
textMatchNoFor condition `text`: how expectedText is compared. `contains` (default) is a case-insensitive substring; `equals` is a case-insensitive full-string match.
timeoutMsNoMax time to wait for the condition before giving up (default 5000).
expectedTextNoFor condition `text`: the string the first visible matched element (topmost in reading order; the first match overall if none is visible) must contain (default) or equal — see `textMatch`. Case-insensitive.
pollIntervalMsNoHow often to re-check the tree (default 400).
Behavior5/5

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

With no annotations, the description fully discloses behavior: it blocks, polls the accessibility/DOM tree, details conditions (exists, visible, hidden, text) with precise semantics, explains selector matching, and describes return value and failure behavior. Very transparent.

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 well-structured with a concise main statement, a bullet list of conditions, and a clear example of usage. Every sentence adds value without redundancy. It is appropriately sized for the complexity.

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 8 parameters, complex conditions, nested objects, and no output schema, the description covers all necessary context: behavior, conditions, selector semantics, return value, polling defaults, and typical use cases. It is complete.

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%, but the description adds significant meaning beyond the schema: it explains selector matching rules (reading order, fallback, loose selector caveats) and textMatch behavior. This adds value beyond the parameter descriptions, earning a 4.

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 blocks until a UI element reaches an expected state or timeout, with the specific verb 'await' and resource 'UI element'. It distinguishes itself from manual polling by mentioning screenshot/describe, and the purpose is immediately clear.

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?

It provides explicit when-to-use scenarios: after tap/navigation or before tapping async elements. It does not explicitly name alternative tools but implies not to poll manually. A clear 4, missing explicit when-not-to-use or sibling differentiation.

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