Skip to main content
Glama

Wait for element

wait_for_element
Read-only

Poll the page until a CSS selector or interaction-tree element appears, synchronizing after clicks or navigation and returning timeout reasons if absent or hidden.

Instructions

Wait until an element appears on the page, polling until it does.

The right way to synchronise with a single-page app after a click or navigation — more reliable than wait with a guessed duration. Returns how long it took, or an error naming why it never matched (absent, or present but hidden, with similarly named ids as suggestions).

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_for_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabNoTab id from list_tabs or new_tab to act on, instead of the active tab. The active tab does not change. Omit to use the active tab. Example: 'tab_2'
timeoutNoMaximum seconds to wait before giving up. The default suits single-page apps. Example: 30.0
visibleNoRequire the element to be visible, not merely present in the DOM. Set false to accept a hidden element. Example: true
selectorYesCSS selector, or a numeric id from get_interaction_tree, to wait for. Example: '#results .item'

Output Schema

NameRequiredDescriptionDefault
foundYesAlways true: a miss is reported as an error.
elapsedYesSeconds until it appeared.
summaryYesOne line saying what happened.
selectorYesThe selector or id waited for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4/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, so safety is covered; the description goes further by disclosing the polling strategy, that it returns elapsed time, and that failures produce an error distinguishing 'absent' from 'present but hidden' with similarly named id suggestions. That error-mode detail is genuinely useful context not present in the annotations. It does not say how a timeout differs from a not-found error, which is the remaining gap.

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 short sentences, front-loaded with the core behavior, then the rationale, then the return/error contract. No filler, no restatement of the tool name, and the parenthetical detail is scoped tightly.

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?

With annotations, full schema coverage, an output schema and only four parameters, the description covers purpose, timing, and error surface, which is enough to call the tool correctly. The one omission is how the timeout parameter interacts with the returned error, so it falls just short of fully complete.

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 tab, timeout, visible and selector are all fully documented in the schema, and the description adds no syntax or semantics beyond it. Baseline 3 applies since the schema does the heavy lifting.

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 and resource: 'Wait until an element appears on the page, polling until it does.' The polling mechanism is named, which distinguishes it from a passive existence check. It does not explicitly differentiate itself from the other page-reading siblings (get_interaction_tree, get_text_content), so it lands at 4 rather than 5.

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?

Gives explicit usage context — 'synchronise with a single-page app after a click or navigation' — and contrasts with 'wait with a guessed duration', making the alternative and its weakness concrete. It stops short of stating when not to use it (e.g., for multiple elements or stable already-present content), so no exclusion guidance.

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