Skip to main content
Glama

glass_wait_for_element

Blocks execution until a UI element reaches a specified state (e.g., appears, enabled, hidden) and returns the element's accessible details for further automation.

Instructions

Block until a UI element reaches a precise state, then return it as text (no image). Select by name (accessible-name substring) and/or role (e.g. "Button"); condition (default appears): appears|disappears|enabled|disabled|checked|unchecked|selected|unselected|expanded|collapsed|focused|visible|hidden; optional value_contains. Returns {matched,elapsed_ms,element{id,role,name,bounds,states}} — the id is usable with glass_click_element. On timeout returns {matched:false}. Waits through a just-launched app that has not published its accessibility tree yet, and errors if none appeared before the timeout. Collapses screenshot poll-loops into one call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoSubstring of the element's accessible name (selector).
roleNoElement role filter, e.g. "Button", "ProgressBar" (selector).
conditionNoWhat to wait for (default "appears"): appears|disappears|enabled|disabled| checked|unchecked|selected|unselected|expanded|collapsed|focused|visible|hidden. `checked`/`unchecked` only match a checkable element (one exposing a real toggle state) — a non-toggle element matches neither.
timeout_msNoGive up after this long (default 10000ms); returns `{matched:false}`.
interval_msNoPoll interval (default 200ms — an a11y snapshot per tick).
value_containsNoAdditionally require the matched element's `value` to contain this substring. Not a standalone selector — `name` and/or `role` is still required.
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so thoroughly. It details the return format on success and on timeout, the handling of apps without an accessibility tree, error behavior if no element appears, and the fact that it returns text rather than an image. It also clarifies that value_contains is not a standalone selector, adding meaningful behavioral nuance.

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 dense but every sentence contributes useful information: purpose, selector options, return structure, timeout behavior, edge-case handling, and relationship to other tools. It uses concise formatting with semicolons and code-formatted terms, making the complex tool scannable without fluff. It's appropriately sized for the feature set.

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 a tool with six parameters and no output schema, the description is remarkably complete. It explains the return object (including the element fields), the timeout response, the condition enum, and the special handling for a11y-tree lag. It even ties the returned id to a follow-up action (glass_click_element), covering the full usage lifecycle. There are no obvious gaps given the complexity and available structured data.

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?

The schema already has 100% parameter description coverage, so the baseline is 3. The description summarizes the key parameter groups (name, role, condition, value_contains) but doesn't add information beyond the schema. It does restate the default condition and the optional nature of value_contains, but these are already in the schema. No significant added meaning for parameters.

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 action: 'Block until a UI element reaches a precise state, then return it as text (no image).' It specifies the resource (UI element) and the verb (block/wait), and distinguishes itself from sibling tools like glass_wait_for_log and glass_wait_for_region by focusing on element state. The 'no image' contrast also sets it apart from screenshot-based alternatives.

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 clear context for when to use the tool, such as waiting for a specific element state and handling a just-launched app that hasn't published its accessibility tree yet. It also suggests it replaces screenshot poll-loops ('Collapses screenshot poll-loops into one call') and notes the returned id works with glass_click_element. However, it doesn't explicitly name alternative tools for other wait scenarios, so it lacks full exclusion guidance.

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/fixed-width/glass'

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