Skip to main content
Glama

wait_for

Wait until an element or text reaches a requested state on dynamic pages, with timeout control. Synchronize automation steps by pausing until a condition is met.

Instructions

Wait until an element or text reaches a requested state.

When text is provided, a state of 'present' or 'visible' both wait for the text to appear within the selector, and a state of 'not_visible' or 'absent' both wait for the text to be absent from the selector.

Use this tool when the page is dynamic and an automation step must wait for a condition before continuing.

Unlike check_condition, this tool intentionally waits. Unlike assert_condition, its purpose is synchronization rather than validating a test expectation.

Args: state: - "present": Wait until the matching element exists. - "visible": Wait until the matching element is visible. - "not_visible": Wait until the matching element is not visible. - "absent": Wait until the matching element no longer exists. (This is handled differently when text is provided.) selector: CSS selector or SeleniumBase selector for the element. Required unless text is supplied. text: If supplied and is not None, a state of 'present' or 'visible' both wait for the text to appear within the selector, and a state of 'not_visible' or 'absent' both wait for the text to be absent from the selector (or within "body" when selector is omitted). timeout: Maximum seconds to wait for the requested state to be true. (Defaults to 7 seconds.)

Returns: A confirmation when the requested condition is reached.

Tool selection: - Check current state immediately -> use check_condition. - Wait for a state/content transition -> use wait_for. - Verify an expected value/condition -> use assert_condition.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo
stateNovisible
timeoutNo
selectorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv4.53.7
    • removedInput schema / properties / timeout / anyOf
      Removed value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / timeout / type
      Added value: +"number"
  2. Changed1 schema field changedv4.53.2
    • changedInput schema / properties / timeout / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  3. Addedv1.0.1

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral disclosure burden. It explains that the tool intentionally waits, is for synchronization rather than validation, and clarifies how 'text' alters the meaning of 'present'/'visible' and 'absent'/'not_visible'. It does not discuss polling behavior or error handling, but the core behavior is clearly disclosed.

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 organized with clear sections (intro, Args, Returns, Tool selection) and front-loads the core purpose. However, the text/state caveat is nearly identical in the intro and in the 'text' parameter explanation, making it slightly redundant. Still, no irrelevant content is present.

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?

Given the tool's complexity, the description comprehensively covers purpose, when to use it, all parameters, state semantics, and alternatives. An output schema exists, so return value details are not required, and the description even summarizes the return ('A confirmation'). Nothing critical is missing.

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

Parameters5/5

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

Schema coverage is 0%, so the description must fully document the parameters. It does: each state value is explained, selector's requirement is stated, text's special handling is detailed, and timeout's default is given. This adds far more meaning than the bare parameter names and enums in the schema.

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 states a specific verb and resource: it waits for an element or text to reach a requested state. It clearly distinguishes itself from sibling tools check_condition and assert_condition, so an agent can tell exactly which tool fits which purpose.

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?

Includes an explicit 'Use this tool when' statement about dynamic pages and waiting, plus a dedicated 'Tool selection' section that contrasts wait_for with check_condition and assert_condition. This gives the agent concrete selection criteria and exclusions.

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

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/seleniumbase/SeleniumBase'

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