Skip to main content
Glama

wait_for

Wait for a page to reach a condition—element, text, URL, network idle, or JS expression—then continue. Use assert to verify instantly instead of waiting.

Instructions

Wait until a condition holds: element visible, page text present, URL match, network idle, or a JS expression true. Prefer condition 'text' over a JS expression for 'has the page said X yet'. assert: true checks once and fails instead of waiting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoSubstring of the page URL; required for condition 'url'
textNoSubstring of document.body.innerText, case-sensitive; required for condition 'text'
assertNoCheck once, fail if it does not hold; timeout 0, _meta.code 'assertion_failed'
timeoutNoMax wait in ms (default 10000; 0 when assert is true)
selectorNoCSS selector or ref; required for condition 'element'
conditionYeselement | text | url | network_idle | js
expressionNoExpression that should become true; required for condition 'js'

Schema Changelog

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

  1. Changed9 schema fields changedv2.10.5
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / assert / description
      Previous value: -"Assert instead of wait: check the condition once and fail if it does not hold (default timeout becomes 0). Failures carry _meta.code = 'assertion_failed'."New value: +"Check once, fail if it does not hold; timeout 0, _meta.code 'assertion_failed'"
    • changedInput schema / properties / condition / description
      Previous value: -"What to wait for: element visibility, visible page text, the URL, network idle, or a JS expression returning true"New value: +"element | text | url | network_idle | js"
    • changedInput schema / properties / expression / description
      Previous value: -"JavaScript expression that should evaluate to true — required when condition is 'js'"New value: +"Expression that should become true; required for condition 'js'"
    • changedInput schema / properties / selector / description
      Previous value: -"CSS selector or element ref (e.g. 'e5') — required when condition is 'element'"New value: +"CSS selector or ref; required for condition 'element'"
    • changedInput schema / properties / text / description
      Previous value: -"Substring of the page's visible text — required when condition is 'text'. Case-sensitive; matches document.body.innerText, i.e. what a reader sees."New value: +"Substring of document.body.innerText, case-sensitive; required for condition 'text'"
    • changedInput schema / properties / timeout / description
      Previous value: -"Maximum wait time in milliseconds (default: 10000, or 0 when assert is true)"New value: +"Max wait in ms (default 10000; 0 when assert is true)"
    • changedInput schema / properties / url / description
      Previous value: -"Substring of the page URL — required when condition is 'url'"New value: +"Substring of the page URL; required for condition 'url'"
  2. Changed7 schema fields changedv2.10.0
    • addedInput schema / properties / assert
      Added value: +{
      +  "default": false,
      +  "description": "Assert instead of wait: check the condition once and fail if it does not hold (default timeout becomes 0). Failures carry _meta.code = 'assertion_failed'.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / condition / description
      Previous value: -"What to wait for: element visibility, network idle, or JS expression returning true"New value: +"What to wait for: element visibility, visible page text, the URL, network idle, or a JS expression returning true"
    • changedInput schema / properties / condition / enum
      Previous value: -[
      -  "element",
      -  "network_idle",
      -  "js"
      -]New value: +[
      +  "element",
      +  "text",
      +  "url",
      +  "network_idle",
      +  "js"
      +]
    • addedInput schema / properties / text
      Added value: +{
      +  "description": "Substring of the page's visible text — required when condition is 'text'. Case-sensitive; matches document.body.innerText, i.e. what a reader sees.",
      +  "type": "string"
      +}
    • removedInput schema / properties / timeout / default
      Removed value: -10000
    • changedInput schema / properties / timeout / description
      Previous value: -"Maximum wait time in milliseconds (default: 10000)"New value: +"Maximum wait time in milliseconds (default: 10000, or 0 when assert is true)"
    • addedInput schema / properties / url
      Added value: +{
      +  "description": "Substring of the page URL — required when condition is 'url'",
      +  "type": "string"
      +}
  3. First observedv2.7.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden. It explains the core polling-style behavior, the five condition types, and the critical assert mode that checks once and fails instead of waiting. This is meaningful behavioral context beyond the bare schema.

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?

Three sentences with no filler. The main purpose is front-loaded, condition selection guidance is next, and assert behavior is saved for last. Every sentence earns its place.

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?

The tool is moderately complex with seven parameters and no annotations, but the schema covers every parameter and the description covers the core behaviors and condition choices. It could go further by mentioning timeout failure behavior or the relationship to observe, but as paired with the schema it is largely complete for correct invocation.

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%, so the baseline is 3. The description adds value by advising when to use 'text' instead of a JS expression, which helps an agent choose the correct condition parameter. It also clarifies the semantic effect of assert, adding meaning beyond the parameter descriptions.

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?

Theescription clearly states what the tool does: wait until a condition holds, and enumerates the supported condition types (element, text, URL, network_idle, JS). It is specific about the resource and actions, but does not explicitly differentiate itself from sibling tools such as observe, so it loses the full marks for sibling diistinction.

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?

The description provides useful internal selection guidance, particularly preferring condition 'text' over JS expressions for checking page text, and explains the assert: true behavior. However, it does not address when to use wait_for versus a sibling tool such as observe or evaluate, so the usage guidance is partial.

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/Silbercue/public-browser'

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