Skip to main content
Glama

wait_for_element

Pause execution until a specific element appears in the Firefox browser, using a selector and optional timeout for efficient automation and debugging workflows.

Instructions

Wait for element to appear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes
tabIdNo
timeoutNo

Implementation Reference

  • The core handler function that implements the wait_for_element tool logic using Playwright's page.waitForSelector to wait for the specified selector on the given tab/page.
    async waitForElement(args) {
      this.ensureBrowserRunning();
      const { selector, timeout = 30000, tabId } = args;
      const page = this.getPage(tabId);
      
      await page.waitForSelector(selector, { timeout });
      
      return {
        content: [{
          type: 'text',
          text: `Element '${selector}' found in tab '${tabId || this.activeTabId}'`
        }]
      };
    }
  • The input schema and tool metadata definition returned in ListToolsRequestSchema response.
    {
      name: 'wait_for_element',
      description: 'Wait for element to appear',
      inputSchema: {
        type: 'object',
        properties: {
          selector: { type: 'string' },
          timeout: { type: 'number', default: 30000 },
          tabId: { type: 'string' }
        },
        required: ['selector']
      }
    },
  • The switch case in CallToolRequestSchema handler that registers and dispatches calls to the waitForElement handler.
    case 'wait_for_element':
      return await this.waitForElement(args);
    case 'execute_script':
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 'wait' and 'appear', implying a time-based operation, but doesn't specify what happens on timeout, whether it polls or uses events, if it blocks execution, or what permissions are needed. For a tool with 3 parameters and no annotations, this is a significant gap in describing behavior beyond the basic action.

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 phrase 'Wait for element to appear', which is front-loaded and wastes no words. Every part earns its place by conveying the core action and target efficiently, making it easy to scan and understand at a glance.

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 the tool's complexity (3 parameters, no annotations, no output schema), the description is incomplete. It doesn't cover parameter meanings, behavioral details like error handling or return values, or how it fits with siblings in a browser automation context. For a tool that likely interacts with web pages, more context is needed to be fully helpful.

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 description coverage is 0%, so the description must compensate for undocumented parameters. It adds no meaning beyond the schema—it doesn't explain what 'selector', 'tabId', or 'timeout' represent, their formats, or how they interact. With 3 parameters and no schema descriptions, the description fails to provide necessary semantic context, leaving parameters largely unexplained.

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?

The description 'Wait for element to appear' states a clear action ('wait for') and target ('element'), but it's vague about what 'element' means in this context (e.g., DOM element, UI component) and doesn't distinguish from siblings like 'get_page_content' or 'execute_script'. It avoids tautology by not restating the name 'wait_for_element' exactly, but lacks specificity about the resource or environment.

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 prerequisites (e.g., needing an active browser/tab), exclusions, or compare to siblings like 'get_page_content' for checking element existence. Usage is implied only by the action 'wait', but no explicit context or alternatives are stated.

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/JediLuke/firefox-mcp-server'

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