Skip to main content
Glama

wait_for_element

Wait for a matching UI element to appear or reach a specified state after async actions, and detect blocking modal dialogs early instead of timing out.

Instructions

Wait until a matching element exists and optionally has the given state. Useful after clicks that trigger async UI changes.

If a modal dialog keeps the window disabled for a few seconds, the wait ends early with an error naming it and the dialog's window info, so it can be answered instead of waiting out the timeout.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "window_id": "<window_id>"
    },
    "name": "wait_for_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
roleNo
stateNo
timeoutNo
window_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.1/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It does valuable work by disclosing a non-obvious early-exit behavior: a disabled window due to a modal ends the wait with an error naming the dialog and its window info. It does not say what happens when the wait times out (error vs. return value), whether it polls, or whether it blocks — the central outcome of a wait tool remains unspecified.

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?

Three short sentences, front-loaded with the core action and the triggering use case before the edge-case detail. The third sentence is longer than needed but every clause carries real information about the modal behavior.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

A blocking wait with five entirely undocumented parameters, no annotations and no output schema. The description covers the behavioral edge case well but leaves the parameter contract and timeout semantics unexplained, which is not enough for an agent to call it reliably.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across five parameters, so the description must compensate and largely does not. 'Matching element' vaguely points at name/role and 'the given state' at state, but no accepted values are given for state (no enums exist), and timeout and window_id are never mentioned in the prose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Wait until a matching element exists and optionally has the given state.' The word 'element' plus the name/role matching distinction separates it in spirit from wait_for_text and wait_for_window, though no sibling is named explicitly.

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

Usage Guidelines3/5

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

'Useful after clicks that trigger async UI changes' gives a concrete usage context, and the modal-dialog note implies a recovery path. However, it never says when NOT to use it or which of the sibling waits (wait_for_text, wait_for_window) to prefer for a given situation, leaving the choice to inference.

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