Skip to main content
Glama
Wladastic

AutoProbeMCP

by Wladastic

wait_for_element

Wait for a web element to reach a specified state—attached, detached, visible, or hidden—using a CSS selector and configurable timeout.

Instructions

Wait for an element to appear or disappear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element
timeoutNoTimeout in milliseconds
stateNoState to wait forvisible

Implementation Reference

  • Zod schema for the wait_for_element tool input validation: selector (string, required), timeout (number, default 30000), state (enum: attached/detached/visible/hidden, default 'visible').
    const WaitForElementSchema = z.object({
      selector: z.string(),
      timeout: z.number().default(30000),
      state: z.enum(['attached', 'detached', 'visible', 'hidden']).default('visible')
    });
  • src/index.ts:256-280 (registration)
    Tool registration in the ListToolsRequestSchema handler: declares 'wait_for_element' with name, description, and inputSchema.
    {
      name: 'wait_for_element',
      description: 'Wait for an element to appear or disappear',
      inputSchema: {
        type: 'object',
        properties: {
          selector: {
            type: 'string',
            description: 'CSS selector for the element'
          },
          timeout: {
            type: 'number',
            default: 30000,
            description: 'Timeout in milliseconds'
          },
          state: {
            type: 'string',
            enum: ['attached', 'detached', 'visible', 'hidden'],
            default: 'visible',
            description: 'State to wait for'
          }
        },
        required: ['selector']
      }
    },
  • Handler implementation for the wait_for_element tool. Parses input with WaitForElementSchema, then calls Playwright's page.waitForSelector() with the provided selector, timeout, and state. Returns a success message with the selector and its current state.
    case 'wait_for_element': {
      if (!currentPage) {
        throw new Error('No browser page available. Launch a browser first.');
      }
    
      const params = WaitForElementSchema.parse(args);
      await currentPage.waitForSelector(params.selector, {
        timeout: params.timeout,
        state: params.state as any
      });
    
      return {
        content: [
          {
            type: 'text',
            text: `Element ${params.selector} is now ${params.state}`
          }
        ]
      };
    }
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It omits critical details such as what happens on timeout, whether the tool is blocking, and what the return value is. The schema indicates a timeout default but the description does not explain behavior.

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?

The description is a single, concise sentence. It is efficient but could be slightly expanded to include behavior details without losing conciseness.

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?

Given three parameters and no output schema or annotations, the description is incomplete. It fails to clarify timeout handling, return values, or polling behavior, which are essential for correct usage.

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 the baseline is 3. The description does not add meaning beyond the schema, but the schema itself is descriptive enough for the three parameters.

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?

The description clearly states the tool waits for an element to appear or disappear, which is a specific verb-resource action. It distinguishes from sibling tools like click_element or type_text, but could be more precise by explicitly mentioning the state parameter options.

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?

No guidance is provided on when to use this tool versus alternatives like polling or other wait mechanisms. There is no mention of prerequisites, context, or exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Wladastic/AutoProbeMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server