Skip to main content
Glama

glass_wait_for_element

Read-only

Wait for UI elements to appear, disappear, or change state using accessibility selectors. Returns match status, elapsed time, and element within a configurable timeout.

Instructions

Wait for semantic transition completion, not pixels/stability. Select by name, description and/or role; value is exact, value_contains is a substring. Supports appears/disappears and state conditions. Returns matched, elapsed_ms and the element; timeout is matched:false. Waits for initial tree publication, but errors if no tree appeared. Batched use fails the sequence on an unmatched predicate. For 2+ known steps, use glass_do.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoSubstring of the element's accessible name (selector).
roleNoElement role filter, e.g. "Button", "ProgressBar", "Document" (selector).
valueNoExact case-sensitive accessible value, requiring another selector and excluding `value_contains`.
conditionNoDefault appears. appears|disappears|enabled|disabled|checked|unchecked|selected|unselected|expanded|collapsed|focused|visible|hidden. checked/unchecked require a real checkable state.
timeout_msNoTimeout in ms (default 10000). Standalone: matched:false; batched: fails the sequence.
descriptionNoAccessible-description substring; can select unnamed controls.
interval_msNoPoll interval (default 200ms — an a11y snapshot per tick).
value_containsNoValue substring; requires name, description and/or role; exclusive with value.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.8.0
    • changedInput schema / properties / condition / description
      Previous value: -"What to wait for (default \"appears\"): appears|disappears|enabled|disabled|\nchecked|unchecked|selected|unselected|expanded|collapsed|focused|visible|hidden.\n`checked`/`unchecked` only match a checkable element (one exposing a real toggle\nstate) — a non-toggle element matches neither."New value: +"Default appears. appears|disappears|enabled|disabled|checked|unchecked|selected|unselected|expanded|collapsed|focused|visible|hidden. checked/unchecked require a real checkable state."
    • changedInput schema / properties / description / description
      Previous value: -"Substring of the element's accessible description (selector). Useful for unnamed\ncontrols whose platform label is exposed as a hint, help text, or description."New value: +"Accessible-description substring; can select unnamed controls."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Give up after this long (default 10000ms); returns `{matched:false}`."New value: +"Timeout in ms (default 10000). Standalone: matched:false; batched: fails the sequence."
    • changedInput schema / properties / value_contains / description
      Previous value: -"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name`, `description`, and/or `role` is still required."New value: +"Value substring; requires name, description and/or role; exclusive with value."
  2. Changed4 schema fields changedv1.5.1
    • addedInput schema / properties / description
      Added value: +{
      +  "description": "Substring of the element's accessible description (selector). Useful for unnamed\ncontrols whose platform label is exposed as a hint, help text, or description.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / role / description
      Previous value: -"Element role filter, e.g. \"Button\", \"ProgressBar\" (selector)."New value: +"Element role filter, e.g. \"Button\", \"ProgressBar\", \"Document\" (selector)."
    • addedInput schema / properties / value
      Added value: +{
      +  "description": "Exact case-sensitive accessible value, requiring another selector and excluding `value_contains`.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / value_contains / description
      Previous value: -"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name` and/or `role` is still required."New value: +"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name`, `description`, and/or `role` is still required."
  3. Addedv1.2.0
  4. Removedv1.0.3
  5. First observedv1.0.1

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, it discloses timeout behavior (matched:false), batched-sequence failure, error when no accessibility tree appears, and the exact return fields (matched, elapsed_ms, and the element). These are meaningful behavioral details not present in the annotations, and there is no contradiction with readOnlyHint.

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?

Purpose is front-loaded, and each sentence covers a distinct concern: scope, selectors, matching semantics, conditions, return values, edge cases, and the sibling alternative. There is no filler, and the brief redundancy with schema timeout descriptions is acceptable given the absence of an output schema.

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?

Despite having no output schema, it explicitly states what is returned and how timeout is represented. Together with the fully documented input schema and read-only annotations, an agent has enough information to invoke the tool correctly, understand failure modes, and distinguish it from related tools.

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?

The input schema already documents all 8 parameters at 100% coverage, so the baseline is 3. The description adds useful selection semantics by stating that name, description, and/or role can be used as selectors and by clarifying exact-value versus substring matching for value and value_contains, which goes slightly beyond the schema's individual property 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 states a precise verb and resource: wait for an element's semantic transition, explicitly contrasted with pixel/stability waiting. It enumerates selection fields and supported conditions, and its scope is clearly distinct from sibling tools like glass_find_elements, glass_wait_stable, and glass_do.

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 gives an explicit exclusion ('not pixels/stability') and a direct alternative for multi-step flows ('For 2+ known steps, use glass_do'). However, it does not explicitly compare against related sibling wait tools such as glass_wait_stable, glass_wait_for_log, or glass_wait_for_region, leaving some routing implicit.

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