Skip to main content
Glama

Ui Wait For Element

ui_wait_for_element
Read-only

Deterministic synchronization — replaces all sleeps. Polls for an element until it reaches state (present|enabled|focused|absent) or times out. A timeout is an EXPLICIT error, never a false success. Returns {satisfied, waited_ms, element_ref?, bounds?, enabled_unknown?}. state:'enabled' is satisfied unless the app publishes AXEnabled=false; if the app publishes no AXEnabled at all the result carries enabled_unknown:true — the wait did not block, but nothing was actually verified about enabled-ness.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roleNoAccessibility role of the element (e.g. AXButton, AXTextField).
labelNoVisible label or title of the element.
matchNoHow to compare label: "exact" (default) or "contains".
stateNoDefault present.
poll_msNoDefault 150.
window_idNoWindow to look in, from list_windows. Narrows the search to one window.
timeout_msNoDefault 5000.
app_bundle_idNoBundle id of the app to look in (e.g. com.apple.Safari). Narrows the search and makes it faster.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / app_bundle_id / description
      Added value: +"Bundle id of the app to look in (e.g. com.apple.Safari). Narrows the search and makes it faster."
    • addedInput schema / properties / label / description
      Added value: +"Visible label or title of the element."
    • addedInput schema / properties / match / description
      Added value: +"How to compare label: \"exact\" (default) or \"contains\"."
    • addedInput schema / properties / role / description
      Added value: +"Accessibility role of the element (e.g. AXButton, AXTextField)."
    • addedInput schema / properties / window_id / description
      Added value: +"Window to look in, from list_windows. Narrows the search to one window."
  2. Changed5 schema fields changed
    • removedInput schema / properties / app_bundle_id / description
      Removed value: -"Bundle id of the app to look in (e.g. com.apple.Safari). Narrows the search and makes it faster."
    • removedInput schema / properties / label / description
      Removed value: -"Visible label or title of the element."
    • removedInput schema / properties / match / description
      Removed value: -"How to compare label: \"exact\" (default) or \"contains\"."
    • removedInput schema / properties / role / description
      Removed value: -"Accessibility role of the element (e.g. AXButton, AXTextField)."
    • removedInput schema / properties / window_id / description
      Removed value: -"Window to look in, from list_windows. Narrows the search to one window."
  3. Changed5 schema fields changed
    • addedInput schema / properties / app_bundle_id / description
      Added value: +"Bundle id of the app to look in (e.g. com.apple.Safari). Narrows the search and makes it faster."
    • addedInput schema / properties / label / description
      Added value: +"Visible label or title of the element."
    • addedInput schema / properties / match / description
      Added value: +"How to compare label: \"exact\" (default) or \"contains\"."
    • addedInput schema / properties / role / description
      Added value: +"Accessibility role of the element (e.g. AXButton, AXTextField)."
    • addedInput schema / properties / window_id / description
      Added value: +"Window to look in, from list_windows. Narrows the search to one window."
  4. Added

TDQS

A4.7/5.0
Behavior5/5

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

The description goes well beyond the readOnly/destructive annotations by disclosing that timeouts are explicit failures, that the enabled state depends on whether AXEnabled is published, and that a missing AXEnabled produces enabled_unknown:true. This gives an agent crucial behavioral nuance that annotations alone cannot convey.

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 earns its place: it states the primary purpose, the timeout contract, the return shape, and a subtle behavior around AXEnabled. The key phrase 'replaces all sleeps' is front-loaded, and there is no filler.

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 polling tool with no output schema, the description is unusually complete: it specifies the return object shape, what happens on timeout, and how ambiguous enabled states are represented. The schema covers the parameters, and the description covers runtime behavior adequately.

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%, so each parameter is already documented. The description adds extra meaning around the state parameter's enabled semantics and the timeout parameter's failure semantics, which the schema does not fully express. This exceeds the baseline without duplicating field docs.

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 names a specific verb ('polls') and resource (an element), and defines the outcome as reaching a target state or timing out. It also differentiates itself from ad-hoc sleeps by calling itself 'deterministic synchronization,' making its role clear next to siblings like web_wait_for.

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 opening 'replaces all sleeps' establishes a clear usage context, and the timeout behavior clarifies a key expectation when using the tool. It does not explicitly enumerate alternatives or when-not-to-use scenarios, but the intended role as the synchronization primitive is clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources