Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

wait_for_element

Wait for a web element to appear using a CSS selector, then extract its content from dynamic pages during web scraping.

Instructions

Wait for an element to appear and extract its content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to scrape
selectorYesCSS selector to wait for
timeoutNoTimeout in milliseconds

Implementation Reference

  • Core handler function that launches a Puppeteer browser, navigates to the URL, waits for the specified selector, extracts and returns the element's text content.
    async waitForElement(config: ScrapingConfig, selector: string): Promise<string> {
      const browser = await this.getBrowser();
      const page = await browser.newPage();
    
      try {
        await page.goto(config.url, {
          waitUntil: 'networkidle',
          timeout: config.timeout || 30000,
        });
    
        await page.waitForSelector(selector, {
          timeout: config.waitForTimeout || 10000,
        });
    
        const text = await page.textContent(selector);
        return text || '';
      } finally {
        await page.close();
      }
    }
  • Tool registration object defining the name, description, and input schema for the 'wait_for_element' tool.
    {
      name: 'wait_for_element',
      description: 'Wait for an element to appear and extract its content',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to scrape',
          },
          selector: {
            type: 'string',
            description: 'CSS selector to wait for',
          },
          timeout: {
            type: 'number',
            description: 'Timeout in milliseconds',
            default: 10000,
          },
        },
        required: ['url', 'selector'],
      },
    },
  • Dispatcher handler case in handleWebScrapingTool that extracts parameters and delegates to DynamicScraper.waitForElement.
    case 'wait_for_element': {
      const selector = params.selector as string;
      const content = await dynamicScraper.waitForElement(config, selector);
      return { selector, content };
    }
  • Input schema defining the expected parameters: url, selector, and optional timeout for the tool.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'URL to scrape',
        },
        selector: {
          type: 'string',
          description: 'CSS selector to wait for',
        },
        timeout: {
          type: 'number',
          description: 'Timeout in milliseconds',
          default: 10000,
        },
      },
      required: ['url', '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 and extraction but lacks details on error handling, what happens on timeout, whether it interacts with dynamic content, or the format of extracted content. For a tool with no annotations, 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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to 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 complexity of a web scraping/waiting tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'extract its content' means in practice, how errors are handled, or what the return value looks like, leaving too much ambiguity 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 (url, selector, timeout). The description adds no additional meaning beyond implying that the selector is used to wait for an element and extract content, but it doesn't clarify parameter interactions or usage nuances. Baseline 3 is appropriate given 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'), and mentions the action ('extract its content'). However, it doesn't explicitly differentiate from sibling tools like 'scrape_by_selector' or 'extract_text', which appear to have overlapping functionality.

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. With siblings like 'scrape_by_selector', 'extract_text', and 'scrape_dynamic_content' that might handle similar tasks, there's no indication of specific scenarios, prerequisites, or exclusions for this tool's use.

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/code-alchemist01/development-tools-mcp-Server'

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