Skip to main content
Glama

browser_wait_for_element

browser_wait_for_element
Read-onlyIdempotent

Wait for a browser element to become attached, detached, visible, or hidden, and refresh its element ID when the page changes so automation can act on the correct target.

Instructions

Wait for an element from browser_get_interactives to become attached, detached, visible, or hidden. Get a fresh element_id if the page revision changed while waiting.

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": {
      "tab_id": "<tab_id>",
      "element_id": "<element_id>",
      "state": "<state>"
    },
    "name": "browser_wait_for_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
stateYes
tab_idYes
frame_idNoChrome frame ID inside the tab from browser_get_frames. 0 is the top document, which is the default.
element_idYesOpaque element_id returned by browser_get_interactives.
session_idNoSession that owns the tab. Pass it on every call so the runtime can refuse a tab another session holds.
timeout_msNo
session_nameNoName for this conversation's Chrome tab group, so the tab bar reads as the task instead of a generated id. Sticky: pass it once when the name becomes clear, and again only to rename.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint, so the safety profile is covered. The description adds meaningful behavior beyond that: element_ids are revision-bound and can go stale mid-wait, which is the key non-obvious trait. It omits what happens on timeout (error vs. empty result), whether the call blocks, and the default wait duration.

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 sentences, zero filler, and the core operation is front-loaded before the caveat. Every clause carries information an agent would otherwise have to infer or discover by failure.

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?

Given no output schema, the description should ideally state return semantics, but for a wait primitive the success signal is implied by the state enum and the annotations cover the safety profile. The one material gap is timeout behavior, which is a moderate omission rather than a blocking one for a 7-parameter tool with 57% schema coverage.

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 coverage is 57%, so the schema documents element_id, frame_id, session_id and session_name but leaves state, timeout_ms and tab_id bare. The description compensates partially by spelling out the four state values in prose, giving them operative meaning (attached/detached/visible/hidden). It says nothing about timeout_ms semantics or the blocking relationship between tab_id and session_id.

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 ('Wait for') and resource ('an element from browser_get_interactives') and enumerates the four terminal states, which pins down the operation precisely. It also points at the sibling that produces element_ids, so an agent knows the prerequisite source. It stops short of explicitly contrasting with the other wait tool (browser_wait_for_download), which keeps it 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 Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The second sentence supplies a real conditional hint: refresh element_id if the page revision changed while waiting. That is genuine when-to guidance for a common failure mode. However, there is no guidance on when to prefer this over polling with browser_observe or browser_get_interactives, nor any when-not condition or timeout expectation.

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