Skip to main content
Glama
xav-ie

Browser Session MCP

wait_for

Read-only

Pauses until a CSS selector matches or specified text appears in the active tab, polling every 100ms. Use after navigate, click, or scroll to handle asynchronously loaded content instead of sleeping.

Instructions

Wait until a CSS selector matches an element, or a text string appears in the page's visible text, in the session's active tab, polling every 100ms. Use it after navigate, click or scroll when content loads asynchronously, instead of sleeping. Pass selector or text; if both are given, only selector is checked. text is a case-sensitive substring of document.body.innerText, so text hidden with CSS doesn't count. It reads the page without changing it. Returns which selector or text matched. Fails with a timeout error if nothing matches within timeout, or if neither argument is given.

Input Schema

NameRequiredDescriptionDefault
textNoText to wait for in document.body.innerText; case-sensitive substring match.
timeoutNoMilliseconds to wait before failing. Default 10000.
selectorNoCSS selector to wait for.
sessionIdYesThe id returned by open_browser_session. Errors if no open session has it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / selector / description
      Added value: +"CSS selector to wait for."
    • addedInput schema / properties / sessionId / description
      Added value: +"The id returned by open_browser_session. Errors if no open session has it."
    • addedInput schema / properties / text / description
      Added value: +"Text to wait for in document.body.innerText; case-sensitive substring match."
    • addedInput schema / properties / timeout / description
      Added value: +"Milliseconds to wait before failing. Default 10000."
  2. First observedv0.1.2

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, and the description reinforces this with 'reads the page without changing it' plus concrete runtime traits: 100ms polling, timeout-based failure, and which value is returned. It does not cover whether the wait can be cancelled or how long the default timeout is (the schema covers the default), so it is strong but not exhaustive.

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 what and the scope lead, usage guidance and precedence follow, and edge cases (case sensitivity, hidden text, timeout failure) close it out. Every sentence adds information; nothing is repetitive of the name or schema.

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 4-parameter, single-required-argument wait tool with no output schema, the description covers invocation, precedence, matching semantics, failure mode, and the return value. An agent has everything needed to call it correctly on the first attempt.

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 coverage is 100%, so the baseline is 3; the description earns extra by documenting the precedence rule when both `selector` and `text` are given, that `text` matches case-sensitively against document.body.innerText, and that CSS-hidden text does not count. These are semantics not visible in the schema field descriptions.

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?

States a specific verb (wait) with two precise resources (CSS selector match / text appearing in visible page text), scoped to the session's active tab and a concrete polling interval. An agent can distinguish it from take_snapshot or evaluate without opening any schema.

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?

Explicitly says to use it 'after navigate, click or scroll when content loads asynchronously, instead of sleeping,' naming both the triggering context and the alternative behavior to avoid. Also states the failure condition when neither argument is supplied, which routes the agent away from calling it blindly.

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