Skip to main content
Glama

glass_wait_for_element

Read-only

Waits for a GUI element to appear, disappear, or reach a state such as enabled or checked, selected by name, role, or description. Returns the matched element or a timeout result.

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. subject_mismatch flags a different app, named by subject in the untrusted block even without an element. 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.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "glass_wait_for_element"
  }
}

Input 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.4/5.0
Behavior5/5

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

Annotations only supply readOnly and openWorld; the description adds the substantive behavior: return fields (matched, elapsed_ms, element), that timeout yields matched:false standalone but fails a batched sequence, that subject_mismatch flags a different app even without an element, and that it errors when no tree appeared. These are non-obvious operational facts an agent cannot derive from structured fields.

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?

Dense but front-loaded: the distinguishing claim comes first, then selector semantics, then return/error behavior, then the sibling hand-off. A few clauses duplicate schema content (value exact vs. value_contains substring), which is minor waste but not damaging.

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?

With no output schema and 8 optional parameters, the description compensates by explaining return values, timeout semantics, the subject_mismatch signal, and the no-tree error case. An agent has enough to invoke it correctly and interpret results without further documentation.

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 coverage is 100%, so the schema already documents every parameter including value/value_contains exclusivity and condition enumerations. The description's 'value is exact, value_contains is a substring' restates what the schema says rather than adding new meaning, so baseline 3 applies.

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 — waiting for a semantic element-state transition — and explicitly contrasts it with pixel/stability waiting, which separates it from glass_wait_stable. Selector basis (name, description, role, value) and supported conditions are named, so the agent knows exactly what operation this performs.

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 clear routing rule for the main alternative: 'For 2+ known steps, use glass_do.' It also implicitly directs stability-based waits elsewhere via 'not pixels/stability.' It does not explicitly address other wait siblings (glass_wait_for_region, glass_wait_for_log), but the guidance it does give is unambiguous.

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