Skip to main content
Glama

batch_webpage_scrape

Scrape multiple webpages simultaneously using concurrent processing to extract content efficiently without requiring official APIs.

Instructions

Batch scrape multiple webpages with concurrent processing support.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYesList of webpage URLs to scrape, up to 20.
maxConcurrentNoMaximum concurrency

Implementation Reference

  • The handler function that implements the batch_webpage_scrape tool. It validates input, processes URLs in concurrent batches using scrapeWebpage from searchService, collects successes and errors, and returns structured results.
    async function handleBatchWebpageScrape(args) {
      const { urls, maxConcurrent = 3 } = args;
      
      if (!Array.isArray(urls) || urls.length === 0) {
        throw new Error('urls must be a non-empty array');
      }
    
      if (urls.length > 20) {
        throw new Error('A maximum of 20 URLs is supported');
      }
    
      if (maxConcurrent < 1 || maxConcurrent > 10) {
        throw new Error('maxConcurrent must be between 1 and 10');
      }
    
      const searchService = (await import('../services/searchService.js')).default;
      
      const results = [];
      const errors = [];
      
      // Process in batches
      for (let i = 0; i < urls.length; i += maxConcurrent) {
        const batch = urls.slice(i, i + maxConcurrent);
        const batchPromises = batch.map(async (url) => {
          try {
            const result = await searchService.scrapeWebpage(url);
            return { success: true, url, data: result };
          } catch (error) {
            return { success: false, url, error: error.message };
          }
        });
        
        const batchResults = await Promise.allSettled(batchPromises);
        
        batchResults.forEach((result) => {
          if (result.status === 'fulfilled') {
            if (result.value.success) {
              results.push(result.value);
            } else {
              errors.push(result.value);
            }
          } else {
            errors.push({ url: 'unknown', error: result.reason?.message || 'Unknown error' });
          }
        });
      }
    
      return {
        tool: 'batch_webpage_scrape',
        totalUrls: urls.length,
        successful: results.length,
        failed: errors.length,
        maxConcurrent,
        results,
        errors,
        timestamp: new Date().toISOString()
      };
  • Tool schema definition including input schema for batch_webpage_scrape, defining urls array and maxConcurrent parameters.
    {
      name: 'batch_webpage_scrape',
      description: 'Batch scrape multiple webpages with concurrent processing support.',
      inputSchema: {
        type: 'object',
        properties: {
          urls: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'List of webpage URLs to scrape, up to 20.',
            minItems: 1,
            maxItems: 20
          },
          maxConcurrent: {
            type: 'number',
            description: 'Maximum concurrency',
            default: 3,
            minimum: 1,
            maximum: 10
          }
        },
        required: ['urls']
      }
    }
  • Registration of the batch_webpage_scrape handler in the main tool dispatcher switch statement.
    case 'batch_webpage_scrape':
      result = await handleBatchWebpageScrape(args);
      break;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'concurrent processing support' but fails to detail critical aspects like rate limits, error handling, authentication needs, or what the tool returns (e.g., content, metadata). This leaves significant gaps in understanding how the tool behaves in practice.

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 and key feature (concurrent processing) without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured for quick comprehension.

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 batch scraping tool with no annotations and no output schema, the description is insufficient. It lacks details on output format, error behavior, performance constraints, and how it differs from siblings. For a tool that likely involves network operations and concurrency, more context is needed to ensure safe and 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 input schema fully documents both parameters (urls and maxConcurrent). The description adds no additional semantic details beyond what the schema provides, such as URL format requirements or concurrency implications. Baseline score of 3 is appropriate as the schema handles parameter documentation adequately.

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 action ('batch scrape') and resource ('multiple webpages'), specifying concurrent processing support, which distinguishes it from single-page scraping tools. However, it does not explicitly differentiate from sibling tools like get_webpage_content or get_webpage_source, which may also involve webpage retrieval, leaving some ambiguity in 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, such as get_webpage_content for single pages or web_search for search-based retrieval. It mentions concurrent processing but does not specify scenarios where batch processing is preferred over individual calls, offering minimal usage context.

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/yc9yc/spider-mcp'

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