Skip to main content
Glama

await-ui-element

Read-only

Waits for a UI element to appear, become visible, disappear, or match text after taps/navigation, returning success or timeout cause so you can avoid manual screenshot polling.

Instructions

Block until a UI element reaches an expected state or the timeout elapses, so you don't have to poll screenshot/describe yourself. It polls the same tree as describe. Use when the next step needs an element that appears or disappears asynchronously, e.g. after a tap or navigation, or before tapping something that loads late. Returns { success: boolean, elapsed: number, note?, cause? }. If the condition does not hold by the timeout, it returns success=false, and that is not always a verdict on the condition: cause says which it was: unmet (the tree was read and the condition was false there), unreadable (no trustworthy read, so nothing was judged) or cancelled. note describes what was seen. Only unmet licenses rewriting the check.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "udid": "<udid>",
      "condition": "<condition>",
      "selector": "<selector>"
    },
    "name": "await-ui-element"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidYesTarget device id from `list-devices` (iOS UDID, Android serial, Vega serial, or Chromium id).
bundleIdNoiOS app bundle id, passed to the describe fallback (see `describe`). Ignored on every other platform, including physical iOS.
selectorYesElement to match. Give at least one field; every given field must match.
conditionYesWhat to wait for. `exists`: the selector matches an element anywhere in the tree. `visible`: it matches one with a non-zero on-screen frame. `hidden`: it matches nothing, or only a zero-area element (e.g. a spinner that went away). `text`: the first visible match in reading order (topmost, then leftmost; the first match overall if none is visible) contains expectedText, or equals it with textMatch `equals`. Only that match is checked, so if a loose selector hits several elements, narrow it to the one holding the text.
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). Maximum: 120000. Must be greater than 0.
expectedTextNoRequired for condition `text`: the string the checked match must contain or equal (see `textMatch`).
pollIntervalMsNoHow often to re-check the tree (default 400). Range: 50 to 5000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / bundleId / description
      Previous value: -"Optional iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on Android / Chromium, and on physical iOS."New value: +"iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on every other platform, including physical iOS."
    • changedInput schema / properties / condition / description
      Previous value: -"What 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."New value: +"What to wait for. `exists`: the selector matches an element anywhere in the tree. `visible`: it matches one with a non-zero on-screen frame. `hidden`: it matches nothing, or only a zero-area element (e.g. a spinner that went away). `text`: the first visible match in reading order (topmost, then leftmost; the first match overall if none is visible) contains expectedText, or equals it with textMatch `equals`. Only that match is checked, so if a loose selector hits several elements, narrow it to the one holding the text."
    • changedInput schema / properties / expectedText / description
      Previous value: -"For 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."New value: +"Required for condition `text`: the string the checked match must contain or equal (see `textMatch`)."
    • changedInput schema / properties / pollIntervalMs / description
      Previous value: -"How often to re-check the tree (default 400)."New value: +"How often to re-check the tree (default 400). Range: 50 to 5000."
    • changedInput schema / properties / selector / description
      Previous value: -"Element to match (text / identifier / role)."New value: +"Element to match. Give at least one field; every given field must match."
    • changedInput schema / properties / timeoutMs / description
      Previous value: -"Max time to wait for the condition before giving up (default 5000)."New value: +"Max time to wait for the condition before giving up (default 5000). Maximum: 120000. Must be greater than 0."
    • changedInput schema / properties / udid / description
      Previous value: -"Target device id from `list-devices` (iOS UDID, Android serial, or Chromium id)."New value: +"Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, or Chromium id)."
  2. Changed1 schema field changedv0.24.0
    • changedInput schema / properties / bundleId / description
      Previous value: -"Optional iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on Android / Chromium."New value: +"Optional iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on Android / Chromium, and on physical iOS."
  3. Changed5 schema fields changedv0.16.0
    • changedInput schema / properties / condition / description
      Previous value: -"What 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."New value: +"What 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."
    • changedInput schema / properties / expectedText / description
      Previous value: -"For condition `text`: case-insensitive substring the first matched element (topmost in reading order) must contain."New value: +"For 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."
    • addedInput schema / properties / selector / additionalProperties
      Added value: +false
    • changedInput schema / properties / selector / properties / identifier / description
      Previous value: -"Case-insensitive substring of the element's identifier (accessibilityIdentifier / resource-id / testid)."New value: +"The element's identifier (accessibilityIdentifier / resource-id / testid), matched case-insensitively as the exact identifier or the unqualified resource-id name ('submit' matches 'com.example.app:id/submit')."
    • addedInput schema / properties / textMatch
      Added value: +{
      +  "description": "For condition `text`: how expectedText is compared. `contains` (default) is a case-insensitive substring; `equals` is a case-insensitive full-string match.",
      +  "enum": [
      +    "contains",
      +    "equals"
      +  ],
      +  "type": "string"
      +}
  4. First observedv0.15.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only supply readOnlyHint=true, and the description goes well beyond that: it discloses the return shape ({success, elapsed, note?, cause?}), warns that success=false is not always a verdict on the condition, and enumerates the three `cause` values (`unmet`, `unreadable`, `cancelled`) with the practical rule that only `unmet` licenses rewriting the check. That is exactly the kind of retry/failure semantics annotations cannot carry.

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?

Front-loaded with the core purpose and the usage trigger, then the return/failure semantics. Sentences are dense but each carries distinct information; the `cause` enumeration is long but justified. Minor tightening possible in the repeated 'note describes what was seen' clause.

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?

For an 8-parameter, read-only tool with a nested selector and no output schema, the description covers purpose, timing, selector behavior, the full return contract, and the failure-mode taxonomy. Nothing an agent needs to call it correctly or interpret its result is missing.

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 description coverage is 100%, so the selector fields, condition enum, textMatch, timeoutMs and pollIntervalMs are already documented in the schema. The description adds little parameter-specific detail beyond reinforcing that a loose selector hitting several elements should be narrowed for the `text` condition. Baseline 3 applies when the schema does the heavy lifting.

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?

States a specific verb and resource — 'Block until a UI element reaches an expected state or the timeout elapses' — and immediately positions it against `describe`/`screenshot` by noting it polls the same tree so you don't have to poll yourself. An agent can distinguish it from the sibling wait tools without opening a schema.

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?

Gives a concrete trigger: 'Use when the next step needs an element that appears or disappears asynchronously, e.g. after a tap or navigation, or before tapping something that loads late.' It also names the alternative it replaces (`describe`/`screenshot` polling). It stops short of an explicit when-not clause, e.g. versus `await-screen-idle` or `await-network-request`.

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