Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

extract_tables

Extract structured table data from web pages for analysis, supporting both static content and dynamic JavaScript-rendered pages.

Instructions

Extract table data from a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to scrape
useBrowserNoUse browser for dynamic content

Implementation Reference

  • Registration of the 'extract_tables' tool including name, description, and input schema.
    {
      name: 'extract_tables',
      description: 'Extract table data from a web page',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to scrape',
          },
          useBrowser: {
            type: 'boolean',
            description: 'Use browser for dynamic content',
            default: false,
          },
        },
        required: ['url'],
      },
    },
  • Dispatcher logic in handleWebScrapingTool for the 'extract_tables' tool, routing to static or dynamic scraper based on useBrowser flag.
    case 'extract_tables': {
      if (config.useBrowser) {
        const data = await dynamicScraper.scrapeDynamicContent(config);
        return data.tables;
      } else {
        return await staticScraper.extractTables(config);
      }
    }
  • The extractTables method in StaticScraper class, which performs the table extraction by calling scrapeHTML and returning the tables.
    async extractTables(config: ScrapingConfig): Promise<TableData[]> {
      const data = await this.scrapeHTML(config);
      return data.tables || [];
    }
  • Core helper logic inside scrapeHTML method for parsing HTML tables using Cheerio, extracting captions, headers, and rows into TableData format.
    const tables: TableData[] = [];
    $('table').each((_, tableElement) => {
      const table: TableData = {
        headers: [],
        rows: [],
      };
    
      // Extract caption
      const caption = $(tableElement).find('caption').text().trim();
      if (caption) {
        table.caption = caption;
      }
    
      // Extract headers
      $(tableElement)
        .find('thead th, thead td, tr:first-child th, tr:first-child td')
        .each((_, header) => {
          table.headers.push($(header).text().trim());
        });
    
      // Extract rows
      $(tableElement)
        .find('tbody tr, tr')
        .each((_, row) => {
          const rowData: string[] = [];
          $(row)
            .find('td, th')
            .each((_, cell) => {
              rowData.push($(cell).text().trim());
            });
          if (rowData.length > 0) {
            table.rows.push(rowData);
          }
        });
    
      if (table.headers.length > 0 || table.rows.length > 0) {
        tables.push(table);
      }
    });
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 states what the tool does but lacks critical behavioral details: it does not describe the output format (e.g., structured data like JSON or CSV), error handling, performance implications, or rate limits. For a web scraping tool with no annotation coverage, this is a significant gap in transparency.

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 is front-loaded with the core purpose. There is no wasted language or redundancy, making it easy to parse quickly. It earns its place by clearly stating the tool's function without unnecessary elaboration.

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 web scraping (which can involve dynamic content, errors, and varied outputs), the description is incomplete. There is no output schema, and the description does not explain return values or behavioral traits. With no annotations and minimal parameter guidance beyond the schema, the description fails to provide enough context for effective tool use in a real-world scenario.

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%, with both parameters ('url' and 'useBrowser') well-documented in the schema. The description does not add any meaning beyond what the schema provides—it mentions 'web page' which aligns with the 'url' parameter but offers no additional context for 'useBrowser' or parameter interactions. With high schema coverage, the baseline score of 3 is appropriate.

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 'Extract table data from a web page' clearly states the verb ('extract'), resource ('table data'), and source ('web page'), making the purpose immediately understandable. It does not explicitly differentiate from sibling tools like 'extract_text' or 'scrape_html', but the focus on 'table data' provides some implicit distinction. This is clear but lacks explicit sibling differentiation.

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 does not mention when to choose it over sibling tools like 'extract_text', 'scrape_html', or 'parse_csv', nor does it specify prerequisites or exclusions. Without any usage context, the agent must infer based on the tool name alone.

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