Skip to main content
Glama
Playwright MCP Server

Playwright MCP Server

by sohitmahato

playwright_wait_for_selector

Waits for a CSS selector to reach a specified state, such as visible or hidden, with an optional timeout to synchronize browser automation and testing steps.

Instructions

Wait for an element to appear

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": "playwright_wait_for_selector"
  }
}

Input Schema

NameRequiredDescriptionDefault
stateNo
timeoutNoTimeout in ms
selectorYesCSS selector to wait for

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.4/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 and does almost none of it. It does not say what happens on timeout (throw vs. return null), what the default timeout is, which state is assumed when the parameter is omitted, or what value is returned. For a blocking wait operation these omissions are significant.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single six-word phrase with zero padding and the key concept front-loaded. It is efficiently structured; the brevity itself is not the problem, the missing content is.

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

Completeness2/5

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

With no annotations, no output schema, and three parameters, the description should explain failure behavior and default state. It instead leaves the agent guessing about timeouts, error handling, and return values for what is a blocking operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 67% — selector and timeout are described in the schema, but the state parameter has only an enum with no explanation of default behavior. The description adds no parameter meaning at all, so an agent must infer from the enum values alone that state defaults to something like "visible".

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Wait for an element" states a clear verb and resource, so the general purpose is recognizable. However, the qualifier "to appear" narrows the meaning in a way that conflicts with the schema's own state enum, which allows waiting for the element to become detached or hidden — the opposite of appearing. That makes the stated purpose partially misleading rather than fully precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

The description gives no guidance on when to use this versus a direct action like playwright_click or playwright_extract_text, which already perform their own waiting. There is no mention of typical contexts (after navigation, before interaction) or of 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.