Skip to main content
Glama

wait_for_element

Waits for an iOS UI element to appear or disappear, optionally scrolling and matching by ID, text, type, or index. Use it to synchronize tests before tapping or asserting on the element.

Instructions

Wait until an element appears (or disappears with gone=true).

Input Schema

NameRequiredDescriptionDefault
idNoExact accessibility identifier
goneNo
textNoMatches label, identifier, value or placeholder (exact first, then substring, case-insensitive)
typeNoElement type, e.g. Button, TextField, Cell, Switch
exactNoRequire an exact text match
indexNoPick the Nth best match (0-based)
deviceNoDevice UDID or name substring. Defaults to the select_device choice, then IOS_DEVICE_MCP_DEVICE, else the single USB-connected device.
timeoutNoSeconds to wait for the element (default 5)
maxScrollsNoScroll attempts when scrollDirection is set (default 8)
scrollDirectionNoIf not found, scroll this way and look again (lists load lazily, so off-screen rows may not exist yet)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations and no output schema, the description carries full behavioral burden but only says it waits. It never states what happens on timeout (error vs. false), whether it polls or re-queries, or that it can scroll the UI to find lazy-loaded rows — the latter is only visible in the schema. The gone=true inversion is the one genuinely useful disclosure.

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?

A single short sentence with the primary behavior front-loaded and the alternate mode parenthesized. Nothing is wasted or buried.

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

Completeness3/5

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

The schema is rich enough to enumerate selectors, timeout and scroll options, but for a 10-parameter tool with no annotations and no output schema, the description should at least cover failure/timeout semantics and return behavior. As written, an agent cannot predict what a failed wait yields.

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 description coverage is 90%, so the schema already explains id, text, type, index, timeout, scrollDirection and maxScrolls. The description adds meaning only for the undocumented 'gone' flag and for 'exact' vs. text matching, so it sits just above baseline without materially enriching the parameter set.

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?

Specific verb and resource: 'Wait until an element appears (or disappears with gone=true).' An agent can immediately tell this is a polling/blocking lookup rather than a snapshot or an action like tap_element. It does not explicitly name a sibling alternative, so it stops short of 5.

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?

Usage is only implied: the word 'Wait' signals this is for elements that may not be present yet, and gone=true covers the disappearance case. There is no statement of when to prefer this over describe_ui or tapping, and no note about preconditions such as a started driver or selected device.

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