Skip to main content
Glama

wait_for

Poll browser until a CSS selector, text, or JavaScript predicate meets a condition, then return. Fails with last observed state on timeout.

Instructions

Poll until a condition holds, then return. Fails with what it last saw.

Args: selector: CSS selector to watch. state: 'visible', 'hidden', 'present', 'absent', 'enabled', or 'text' (with the text argument). text: Substring to look for when state is 'text'. predicate: A JavaScript expression to poll instead of a selector, e.g. "document.readyState === 'complete'". tab_id: Exact tab id. url_pattern: Regex matched against tab URLs. timeout_ms: How long to keep polling. poll_ms: Interval between checks, minimum 50.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo
stateNovisible
tab_idNo
poll_msNo
selectorNo
predicateNo
timeout_msNo
url_patternNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses polling behavior, timeout, interval, failure mode ('Fails with what it last saw'), and the two mutually exclusive modes. It does not mention side effects (likely none) or whether it throws on timeout vs. returns a sentinel, but the core behavioral contract is well covered.

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 compact and front-loaded: the core behavior is in the first sentence, followed by a tight parameter list. Every line adds information; there is no filler or repetition of schema defaults.

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?

For an 8-parameter tool with no annotations and 0% schema coverage, the description covers the main usage modes, parameters, and failure behavior. It does not specify the return value format, but the presence of an output schema mitigates that gap. It also does not clarify precedence when multiple filters (selector, predicate, tab_id, url_pattern) are combined, which is a minor completeness gap.

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 0%, so the description must compensate, and it does. It explains the meaning of selector, state, text, predicate, tab_id, url_pattern, timeout_ms, and poll_ms, including the minimum poll interval and the text/state dependency. It does not document the output/return value, but an output schema exists, so that is not required here.

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 opens with a precise verb and resource: 'Poll until a condition holds, then return.' It clearly distinguishes this from sibling tools like query_dom or read_tab by framing it as a waiting/synchronization operation rather than a read. The failure behavior ('Fails with what it last saw') adds useful specificity.

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 explains the two main polling modes (selector+state vs. predicate) and gives a concrete example for predicate. It does not explicitly name sibling alternatives or state when not to use it, but the context makes the usage scenario clear: wait for a condition before proceeding. A short exclusion note (e.g., 'for one-shot DOM checks use query_dom') would push this to 5.

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