Skip to main content
Glama

wait_until

Poll for observable desktop conditions like window visibility, element changes, or terminal output to eliminate manual screenshot loops and detect state changes automatically.

Instructions

Purpose: Server-side poll for an observable condition — eliminates screenshot-polling loops when waiting for state changes. Details: condition selects what to watch: window_appears/window_disappears (target.windowTitle required), focus_changes (optional target.fromHwnd), element_appears/value_changes (target.windowTitle + target.elementName required, UIA; min 500ms interval), ready_state (target.windowTitle; visible + not minimized), terminal_output_contains (target.windowTitle + target.pattern required [+target.regex:true], needs terminal tools loaded), element_matches (target.by + target.pattern required, needs browser tools loaded). Returns {ok:true, elapsedMs, observed} on success, or WaitTimeout error with suggest hints. timeoutMs default 5000 (max 60000). Prefer: Use instead of run_macro({sleep:N}) + screenshot loops. Use terminal_output_contains to detect CLI command completion. Use element_matches for browser DOM readiness after navigation. Caveats: terminal_output_contains and element_matches require the respective tool modules to be loaded. element_appears/value_changes spawn a UIA process per poll — interval clamped to 500ms minimum. On WaitTimeout, read the suggest[] array in the error for recovery steps. Examples: wait_until({condition:'window_appears', target:{windowTitle:'Save As'}, timeoutMs:10000}) wait_until({condition:'terminal_output_contains', target:{windowTitle:'Terminal', pattern:'$ '}, timeoutMs:30000}) wait_until({condition:'element_matches', target:{by:'text', pattern:'Submit', scope:'#checkout-form'}})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionYesCondition to wait for. See per-condition target requirements.
targetNoTarget descriptor — fields used depend on condition. Accepts an object literal or a JSON-stringified object.
timeoutMsNoMaximum time to wait (default 5000ms)
intervalMsNoPoll interval (default 200ms — terminal_output_contains uses 500 internally)
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral details: return format ({ok:true, elapsedMs, observed}), error handling (WaitTimeout error with suggest hints), performance characteristics (UIA process per poll, interval clamped to 500ms minimum), prerequisites (tool modules required for certain conditions), and recovery guidance (read suggest[] array on timeout).

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?

The description is well-structured with clear sections (Purpose, Details, Prefer, Caveats, Examples) and every sentence adds value. While comprehensive, it remains focused without redundancy. The front-loaded purpose statement immediately communicates the tool's function, followed by progressively detailed information.

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 complex polling tool with 4 parameters, no annotations, and no output schema, the description provides complete context: purpose, detailed parameter requirements, behavioral characteristics, usage guidelines, caveats, and concrete examples. It compensates fully for the lack of structured metadata while addressing the tool's complexity appropriately.

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 description coverage is 100%, establishing a baseline of 3. The description adds significant value by explaining condition-specific target requirements in detail (e.g., 'window_appears/window_disappears (target.windowTitle required)', 'element_appears/value_changes (target.windowTitle + target.elementName required)'), default values, and practical examples that clarify parameter usage beyond the schema's enum list.

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 explicitly states the purpose as 'Server-side poll for an observable condition' and distinguishes it from alternatives like 'screenshot-polling loops' and 'run_macro({sleep:N})'. It clearly identifies the verb ('poll') and resource ('observable condition') while differentiating from sibling tools like screenshot and run_macro.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool vs alternatives: 'Use instead of run_macro({sleep:N}) + screenshot loops', 'Use terminal_output_contains to detect CLI command completion', and 'Use element_matches for browser DOM readiness after navigation'. It also specifies when NOT to use certain conditions without proper tool modules loaded.

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/Harusame64/desktop-touch-mcp'

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