Skip to main content
Glama

batch_scrape_urls

Extract data from multiple websites simultaneously by scraping up to 10,000 URLs in a single operation for large-scale content collection.

Instructions

Scrape up to 10k URLs at the same time. Perfect for large-scale data extraction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urls_to_scrapeYesJSON array of objects with "url" and optional "custom_id".
output_formatNoChoose format for all URLs. Default: "markdown".markdown
countryNoOptional country code for location-specific scraping.
wait_before_scrapingNoWait time in milliseconds before scraping each URL.
parserNoOptional parser ID for specialized extraction.

Implementation Reference

  • The main execution logic for the batch_scrape_urls tool. It constructs a payload with the provided URLs and options, sends a POST request to the Olostep batch API, handles the response or errors, and returns formatted content.
    handler: async (
    	{
    		urls_to_scrape,
    		output_format,
    		country,
    		wait_before_scraping,
    		parser,
    	}: {
    		urls_to_scrape: BatchScrapeRequestUrl[];
    		output_format: "markdown" | "html" | "json" | "text";
    		country?: string;
    		wait_before_scraping?: number;
    		parser?: string;
    	},
    	apiKey: string,
    	orbitKey?: string,
    ) => {
    	try {
    		const headers = new Headers({
    			"Content-Type": "application/json",
    			Authorization: `Bearer ${apiKey}`,
    		});
    
    		const formats: string[] = [output_format];
    		const payload: Record<string, unknown> = {
    			urls: urls_to_scrape,
    			formats,
    			wait_before_scraping: wait_before_scraping ?? 0,
    		};
    		if (country) payload.country = country;
    		if (orbitKey) payload.force_connection_id = orbitKey;
    		if (parser) payload.parser_extract = { parser_id: parser };
    
    		const response = await fetch(OLOSTEP_BATCH_API_URL, {
    			method: "POST",
    			headers,
    			body: JSON.stringify(payload),
    		});
    
    		if (!response.ok) {
    			let errorDetails: unknown = null;
    			try {
    				errorDetails = await response.json();
    			} catch {
    				// ignore
    			}
    			return {
    				isError: true,
    				content: [
    					{
    						type: "text",
    						text: `Olostep API Error: ${response.status} ${response.statusText}. Details: ${JSON.stringify(
    							errorDetails,
    						)}`,
    					},
    				],
    			};
    		}
    
    		const data = (await response.json()) as OlostepBatchResponse;
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(data, null, 2),
    				},
    			],
    		};
    	} catch (error: unknown) {
    		return {
    			isError: true,
    			content: [
    				{
    					type: "text",
    					text: `Error: Failed to create batch scrape. ${
    						error instanceof Error ? error.message : String(error)
    					}`,
    				},
    			],
    		};
    	}
    },
  • Zod schema defining the input parameters including urls_to_scrape (array of up to 10k URLs), output_format, country, wait_before_scraping, and parser.
    schema: {
    	urls_to_scrape: z
    		.array(
    			z.object({
    				url: z.string().url(),
    				custom_id: z.string().optional(),
    			}),
    		)
    		.min(1)
    		.max(10000)
    		.describe('JSON array of objects with "url" and optional "custom_id".'),
    	output_format: z
    		.enum(["markdown", "html", "json", "text"])
    		.default("markdown")
    		.describe('Choose format for all URLs. Default: "markdown".'),
    	country: z
    		.string()
    		.optional()
    		.describe("Optional country code for location-specific scraping."),
    	wait_before_scraping: z
    		.number()
    		.int()
    		.min(0)
    		.max(10000)
    		.default(0)
    		.describe("Wait time in milliseconds before scraping each URL."),
    	parser: z.string().optional().describe("Optional parser ID for specialized extraction."),
    },
  • src/index.ts:74-86 (registration)
    Registration of the batch_scrape_urls tool with the MCP server using server.tool(), including API key check and wrapper around the tool's handler.
    server.tool(
        batchScrapeUrls.name,
        batchScrapeUrls.description,
        batchScrapeUrls.schema,
        async (params) => {
            if (!OLOSTEP_API_KEY) return missingApiKeyError;
            const result = await batchScrapeUrls.handler(params, OLOSTEP_API_KEY, ORBIT_KEY);
            return {
                ...result,
                content: result.content.map(item => ({ ...item, type: item.type as "text" }))
            };
        }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral disclosure. It mentions scale ('up to 10k URLs') but doesn't cover critical aspects like rate limits, authentication needs, error handling, or what 'scrape' entails (e.g., does it extract text, metadata, full HTML?). The phrase 'at the same time' hints at concurrency but lacks specifics. For a batch operation tool with zero annotation coverage, this is inadequate.

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 (two sentences) and front-loaded with the core functionality. Every word earns its place: first sentence defines the tool, second provides usage context. No wasted words or redundancy.

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 (batch scraping with 5 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what 'scrape' returns (e.g., content, status codes), how errors are handled for partial failures, or performance considerations. For a tool that could involve significant processing and network usage, more context is needed to use it effectively.

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 fully documents all 5 parameters. The description adds no parameter-specific information beyond implying the 'urls_to_scrape' parameter supports batch operations. No additional semantics, constraints, or usage examples are provided. Baseline 3 is appropriate when schema does all the work.

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: 'Scrape up to 10k URLs at the same time' specifies the verb (scrape) and resource (URLs) with a quantitative limit. It distinguishes from siblings like 'scrape_website' (singular) and 'get_webpage_content' (single page) by emphasizing batch capability. However, it doesn't explicitly differentiate from 'create_crawl' which might also handle multiple URLs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context: 'Perfect for large-scale data extraction' suggests when to use this tool (for bulk operations). However, it lacks explicit guidance on when NOT to use it or alternatives (e.g., use 'scrape_website' for single URLs, 'get_webpage_content' for simpler extraction). No prerequisites or exclusions are mentioned.

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

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