Skip to main content
Glama

wait_selector

Waits until a browser element reaches a specified state (visible, hidden, attached, or detached) before continuing, using a selector, text, role, or CSS target with an optional timeout.

Instructions

Wait until an element reaches a state. Takes the same targets as click.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "selector": "<selector>"
    },
    "name": "wait_selector"
  }
}

Input Schema

NameRequiredDescriptionDefault
leaseNoOptional lease token to present if the target session is leased (0.7.0). Threaded per-call; never read from the server's env.
stateNovisible|hidden|attached|detached
sessionNoOptional session name to target (omit for the shared 'default'). On a daemon shared with other agents, pass a UNIQUE name for stateful multi-step work (go→click→fill) so you don't collide on 'default'.
selectorYes@eN ref, visible text, @text:/@label:/@role:, or CSS.
timeout_msNoTimeout in ms.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.21.0
    • changedInput schema / properties / selector / description
      Previous value: -"CSS selector."New value: +"@eN ref, visible text, @text:/@label:/@role:, or CSS."
  2. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden. It discloses that the call blocks until a state is reached, but says nothing about what happens on timeout (raise, return false, silent), whether it is safe to poll, or what the call returns — a significant gap for a blocking wait tool whose timeout is configurable.

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?

Two short sentences, front-loaded with the action and followed by the selector hint. Nothing extraneous and nothing buried.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no annotations and no output schema, the definition should at minimum state the success/failure outcome and timeout behavior, since the agent needs to know whether to branch or retry after a failed wait. The schema covers parameters well, so the gap is confined to outcome semantics.

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 all five parameters including state values and the lease/session semantics are already documented in the schema. The description only adds the cross-reference that selectors accept click's target syntax, which is mildly helpful but mostly redundant.

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?

States a specific verb+resource ('wait until an element reaches a state') and clarifies the selector vocabulary by pointing at click. It does not, however, distinguish itself from near-siblings like is_state, wait_ref, or expect, which an agent could easily confuse with this tool.

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?

'Takes the same targets as click' is a useful usage hint for constructing the selector, and 'wait until' implies blocking page automation. But there is no explicit when-to-use vs. is_state (non-blocking check) or expect, and no note about what to do when the wait fails.

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