Skip to main content
Glama

pilot_wait

Wait for elements to become visible or hidden, for network activity to idle, or for pages to fully load during browser automation.

Instructions

Wait for element visibility, network idle, or page load.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoElement ref or CSS selector to wait for
stateNoWhat to wait for
timeoutNoTimeout in milliseconds (default: 15000)

Implementation Reference

  • The handler implementation for the 'pilot_wait' tool, which uses Playwright to wait for page states or element visibility.
    server.tool(
      'pilot_wait',
      'Wait for element visibility, network idle, or page load.',
      {
        ref: z.string().optional().describe('Element ref or CSS selector to wait for'),
        state: z.enum(['visible', 'hidden', 'networkidle', 'load']).optional().describe('What to wait for'),
        timeout: z.number().optional().describe('Timeout in milliseconds (default: 15000)'),
      },
      async ({ ref, state, timeout }) => {
        await bm.ensureBrowser();
        try {
          const page = bm.getPage();
          const ms = timeout || 15000;
    
          if (state === 'networkidle') {
            await page.waitForLoadState('networkidle', { timeout: ms });
            return { content: [{ type: 'text' as const, text: 'Network idle' }] };
          }
          if (state === 'load') {
            await page.waitForLoadState('load', { timeout: ms });
            return { content: [{ type: 'text' as const, text: 'Page loaded' }] };
          }
          if (ref) {
            const resolved = await bm.resolveRef(ref);
            if ('locator' in resolved) {
              await resolved.locator.waitFor({ state: (state || 'visible') as any, timeout: ms });
            } else {
              await page.waitForSelector(resolved.selector, { state: (state || 'visible') as any, timeout: ms });
            }
            bm.resetFailures();
            return { content: [{ type: 'text' as const, text: `Element ${ref} is ${state || 'visible'}` }] };
          }
          return { content: [{ type: 'text' as const, text: 'Nothing to wait for — provide ref or state' }], isError: true };
        } catch (err) {
          bm.incrementFailures();
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
    );
  • The tool 'pilot_wait' is registered in the list of core tools.
    'pilot_wait',
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 disclosure burden. While it lists what can be waited for, it fails to explain behavioral traits such as what happens on timeout (error thrown vs return value), whether the wait is blocking, or the semantic differences between 'networkidle' and 'load' states.

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 a single, efficient sentence of seven words. It is appropriately front-loaded with the action verb and contains no redundant or wasted language. Every word earns its place.

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no output schema) and complete schema coverage, the description is minimally viable. However, for a synchronization-critical tool with no annotations, it lacks essential context such as error handling behavior, default timeout implications, and guidance on selecting the appropriate wait state.

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?

With 100% schema description coverage ('ref', 'state', 'timeout' all documented), the baseline is 3. The description mentions three specific states ('element visibility', 'network idle', 'page load') which loosely map to enum values, but adds no syntax details, format requirements, or usage patterns beyond what the schema already provides.

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 core action ('Wait for') and the specific conditions (element visibility, network idle, page load). However, it does not explicitly differentiate this tool from similar siblings like pilot_navigate (which may implicitly wait) or pilot_element_state (which checks state without waiting), preventing a score of 5.

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, nor when to choose between the different wait states (e.g., 'networkidle' vs 'load'). It does not mention prerequisites or typical usage patterns within the browser automation workflow.

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/TacosyHorchata/Pilot'

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