Skip to main content
Glama
Wladastic

AutoProbeMCP

by Wladastic

wait_for_element

Monitors web elements for specific states (attached, detached, visible, hidden) using CSS selectors, ensuring synchronization in browser automation workflows within AutoProbeMCP.

Instructions

Wait for an element to appear or disappear

Input Schema

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

Implementation Reference

  • The main handler function for the 'wait_for_element' tool. It validates input using WaitForElementSchema, waits for the specified selector using Playwright's waitForSelector with timeout and state, and returns a success message.
    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}`
          }
        ]
      };
    }
  • Zod schema defining the input parameters for the wait_for_element tool: selector (required string), timeout (default 30000ms), state (enum with 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 ListTools response, including name, description, and inputSchema matching the Zod schema.
    {
      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']
      }
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions waiting for appearance/disappearance but doesn't cover critical aspects like what happens on timeout (e.g., error thrown), whether it's blocking or asynchronous, or performance implications. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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?

The description is extremely concise with a single sentence that directly states the tool's purpose. It's front-loaded and wastes no words, making it easy to parse quickly. Every word earns its place by conveying essential information.

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 no annotations and no output schema, the description is incomplete for a tool with 3 parameters and behavioral complexity. It lacks details on return values (e.g., success/failure, element reference), error handling, and interaction with sibling tools in a browser automation context, leaving the agent with insufficient context for effective use.

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 schema already documents all parameters (selector, state, timeout) with descriptions, defaults, and enums. The description adds no additional parameter semantics beyond what the schema provides, such as examples or edge cases, meeting the baseline for high schema coverage.

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's purpose with a specific verb ('wait for') and resource ('element'), specifying it can wait for appearance or disappearance. However, it doesn't explicitly differentiate from sibling tools like 'get_element_text' or 'click_element' that also involve elements, missing full sibling distinction.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios like waiting before interacting with elements, handling dynamic content, or how it compares to tools like 'click_element' that might implicitly wait. No explicit when/when-not or alternative recommendations are included.

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

Related 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