Skip to main content
Glama

wait_for

Read-onlyIdempotent

Wait for a page condition (element, text, function, navigation, or network idle) with configurable timeout and visibility, returning found:false on timeout instead of throwing.

Instructions

Block until a condition holds: element, text, function (JS expression; needs the "Allow user scripts" toggle), navigation (mode=spa for client-side routes), network_idle. Polls until timeout (10s element/function, 15s the rest) then returns found: false with a reason instead of raising: check it, or a failed wait reads as success. Read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNospa = pushState/popstate/hashchangeload
textNoLiteral text to wait for (condition=text), matched case-insensitively
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
idle_msNoQuiet period ms (network_idle)
timeoutNoMax ms (default 10000; 15000 navigation/network_idle)
visibleNoElement must also be visible
frame_idNoTarget iframe id from get_frames; omitted = main frame
intervalNoPoll ms, min 50
selectorNocondition=element; with condition=text it narrows the search to that subtree
conditionYeselement and text need selector or text; function needs expression
expressionNoJS expression (condition=function)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.11.0
    • changedInput schema / properties / condition / description
      Previous value: -"function needs expression; element needs selector"New value: +"element and text need selector or text; function needs expression"
    • changedInput schema / properties / condition / enum
      Previous value: -[
      -  "element",
      -  "function",
      -  "navigation",
      -  "network_idle"
      -]New value: +[
      +  "element",
      +  "text",
      +  "function",
      +  "navigation",
      +  "network_idle"
      +]
    • changedInput schema / properties / selector / description
      Previous value: -"condition=element"New value: +"condition=element; with condition=text it narrows the search to that subtree"
    • addedInput schema / properties / text
      Added value: +{
      +  "description": "Literal text to wait for (condition=text), matched case-insensitively",
      +  "type": "string"
      +}
  2. Changed3 schema fields changedv1.10.0
    • addedInput schema / properties / condition / description
      Added value: +"function needs expression; element needs selector"
    • addedInput schema / properties / frame_id / description
      Added value: +"Target iframe id from get_frames; omitted = main frame"
    • addedInput schema / properties / tab_id / description
      Added value: +"Target tab; omitted = last tab navigated in this session, else the active one"
  3. First observedv1.8.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description discloses key behavioral details: it blocks execution, returns 'found: false' with a reason instead of raising an error on timeout, and mentions the 'Allow user scripts' toggle dependency for function conditions. This provides practical information about how the tool behaves in edge cases.

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 a single, well-structured paragraph that efficiently lists the condition types, relevant parameters, timeouts, and return behavior without extraneous detail. It is easy to parse and directly addresses the core functionality.

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

Completeness4/5

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

Given the tool's complexity (11 parameters, 5 condition types, enums), the description provides a solid high-level overview but does not explicitly cover every combination or edge case (e.g., interaction between selector and condition=navigation). However, the schema fills these gaps, so the description is sufficiently complete for most usage scenarios.

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?

The input schema already provides comprehensive descriptions for all 11 parameters (100% coverage). The description text adds extra value by clarifying the relationship between selector and text (narrowing search) and by noting the toggle requirement, though these are minor increments over the schema's own explanations.

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 specifies that the tool blocks until a condition holds and enumerates the supported condition types (element, text, function, navigation, network_idle). It distinguishes itself from sibling tools like read_page or get_page_info by focusing exclusively on waiting for state changes, making its purpose unambiguous.

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 implicit usage guidance by explaining each condition type and the associated requirements (e.g., needing the 'Allow user scripts' toggle for function). It does not explicitly compare against alternatives, but the context is sufficient for an agent to decide when to invoke this tool for waiting on asynchronous conditions.

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