Skip to main content
Glama

browser_wait

Stabilize asynchronous flows by waiting for browser conditions: element visible/hidden, text appears, URL contains, load state, or fixed duration.

Instructions

Wait for the browser to reach a specified condition: element visible/hidden/detached, text appears, URL contains substring, load state, or a fixed duration. Used to stabilize asynchronous flows.

中文详情:

  • 用途:等待真实浏览器达到指定状态(元素出现/隐藏、文本出现、URL 包含、加载状态、固定时间),稳定异步流程

  • 何时使用:点击后等待 loading 消失时;异步请求后等待元素出现时;SPA 路由跳转后等待 URL 变化时;轮询前固定延迟时;动画完成后继续操作时

  • 输出:{ ok: boolean, condition: string, elapsed: number, timeout: number, timedOut: boolean }

  • 参数:

    • selector (string, 可选):要等待的 CSS 选择器,配合 state 使用

    • state (string, 可选):选择器状态,可选 attached/detached/visible/hidden,默认 visible

    • text (string, 可选):等待出现的页面文本

    • exact (boolean, 可选):文本是否精确匹配,默认 false

    • nth (number, 可选):当文本匹配多个元素时选择第几个,默认 0

    • urlContains (string, 可选):等待当前 URL 包含该字符串

    • loadState (string, 可选):等待加载状态,可选 load/domcontentloaded/networkidle

    • ms (number, 可选):固定等待毫秒数

    • timeout (number, 可选):超时时间,默认 10000ms

  • 错误:超时抛出 'Timeout XXXXms exceeded';未提供任何等待条件抛出 'No wait condition provided'

  • 示例:{"selector":".loading-spinner","state":"hidden","timeout":15000}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
msNo固定等待毫秒数
nthNo当文本匹配多个元素时选择第几个,默认 0
textNo要等待出现的页面文本
exactNo文本是否精确匹配,默认 false
stateNo选择器状态:attached/detached/visible/hidden,默认 visible
timeoutNo超时时间,默认 10000ms
selectorNo要等待的 CSS 选择器
loadStateNo等待加载状态:load/domcontentloaded/networkidle
urlContainsNo等待当前 URL 包含该字符串
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses output format { ok, condition, elapsed, timeout, timedOut }, error messages (timeout, no condition), and lists all wait conditions. It does not mention authentication or rate limits, but these are not relevant for a wait tool. Overall, good transparency.

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 well-structured with an English intro and a Chinese section breaking down into usage, output, parameters, errors, and example. It is somewhat verbose due to duplication, but the organization helps readability. Front-loaded with the main purpose.

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?

For a tool with 9 optional parameters and no output schema, the description is remarkably complete. It covers all wait conditions, output shape, error messages, and an example. There is no ambiguity about how to use the tool effectively.

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 100%, so the schema already documents all parameters. The description's parameter list is largely redundant but adds context like '配合 state 使用' and '当文本匹配多个元素时'. It also provides an example. However, it doesn't add significant new meaning beyond 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 explicitly states 'Wait for the browser to reach a specified condition' and lists all possible conditions (element visible/hidden/detached, text appears, URL contains, load state, fixed duration). It clearly distinguishes the tool's purpose from sibling browser action tools.

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 Chinese section provides explicit when-to-use scenarios: after clicks waiting for loading, async requests, SPA routing, polling delays, animation completion. While it doesn't explicitly mention when not to use or alternatives, the guidance is clear and practical.

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

Install Server

Other Tools

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/validpilot/ai-verify-mcp'

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