Skip to main content
Glama

scrape_website

Extract content from any website URL in multiple formats including markdown, HTML, JSON, or text. Supports JavaScript rendering and location-specific scraping for dynamic content.

Instructions

Extract content from a single URL. Supports multiple formats and JavaScript rendering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
url_to_scrapeYesThe URL of the website you want to scrape.
output_formatNoChoose format ("html", "markdown", "json", or "text"). Default: "markdown"markdown
countryNoOptional country code (e.g., US, GB, CA) for location-specific scraping.
wait_before_scrapingNoWait time in milliseconds before scraping (0-10000). Useful for dynamic content.
parserNoOptional parser ID for specialized extraction (e.g., "@olostep/amazon-product").

Implementation Reference

  • The main handler function that implements the scrape_website tool logic by calling the Olostep API to scrape the specified URL.
    handler: async (
    	{
    		url_to_scrape,
    		output_format,
    		country,
    		wait_before_scraping,
    		parser,
    	}: {
    		url_to_scrape: string;
    		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 body: Record<string, unknown> = {
    			url_to_scrape,
    			formats,
    			wait_before_scraping: wait_before_scraping ?? 0,
    		};
    		if (country) body.country = country;
    		if (orbitKey) body.force_connection_id = orbitKey;
    		if (parser) {
    			// Include parser-based extraction alongside selected format
    			body.parser_extract = { parser_id: parser };
    		}
    
    		const response = await fetch(OLOSTEP_SCRAPE_API_URL, {
    			method: "POST",
    			headers,
    			body: JSON.stringify(body),
    		});
    
    		if (!response.ok) {
    			let errorDetails: unknown = null;
    			try {
    				errorDetails = await response.json();
    			} catch {
    				// ignore JSON parse error for non-JSON error bodies
    			}
    			return {
    				isError: true,
    				content: [
    					{
    						type: "text",
    						text: `Olostep API Error: ${response.status} ${response.statusText}. Details: ${JSON.stringify(
    							errorDetails,
    						)}`,
    					},
    				],
    			};
    		}
    
    		const data = (await response.json()) as OlostepScrapeResponse;
    		// Return the full result object so callers can access id/url/status/contents
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(data.result ?? {}, null, 2),
    				},
    			],
    		};
    	} catch (error: unknown) {
    		return {
    			isError: true,
    			content: [
    				{
    					type: "text",
    					text: `Error: Failed to scrape website. ${
    						error instanceof Error ? error.message : String(error)
    					}`,
    				},
    			],
    		};
    	}
    },
  • Input schema using Zod for validating parameters of the scrape_website tool.
    schema: {
    	url_to_scrape: z.string().url().describe("The URL of the website you want to scrape."),
    	output_format: z
    		.enum(["markdown", "html", "json", "text"])
    		.default("markdown")
    		.describe('Choose format ("html", "markdown", "json", or "text"). Default: "markdown"'),
    	country: z
    		.string()
    		.optional()
    		.describe("Optional country code (e.g., US, GB, CA) for location-specific scraping."),
    	wait_before_scraping: z
    		.number()
    		.int()
    		.min(0)
    		.max(10000)
    		.default(0)
    		.describe("Wait time in milliseconds before scraping (0-10000). Useful for dynamic content."),
    	parser: z
    		.string()
    		.optional()
    		.describe('Optional parser ID for specialized extraction (e.g., "@olostep/amazon-product").'),
    },
  • src/index.ts:119-131 (registration)
    Registration of the scrape_website tool with the MCP server using server.tool().
    server.tool(
        scrapeWebsite.name,
        scrapeWebsite.description,
        scrapeWebsite.schema,
        async (params) => {
            if (!OLOSTEP_API_KEY) return missingApiKeyError;
            const result = await scrapeWebsite.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 for behavioral disclosure. It mentions 'JavaScript rendering' (useful context) and 'Supports multiple formats' (output behavior), but lacks critical details: whether scraping respects robots.txt, rate limits, authentication needs, error handling, or what 'extract content' specifically means. For a scraping tool with zero annotation coverage, 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (two short sentences) and front-loaded with the core purpose. Every sentence adds value: first states the main action, second adds key capabilities. No wasted words, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters, no annotations, and no output schema, the description is moderately complete. It covers the basic purpose and key features (formats, JavaScript), but lacks details on scraping behavior, error cases, or output structure. For a tool with this complexity and no structured safety/behavior annotations, it should provide more context about limitations or typical use cases.

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 parameters are well-documented in the schema. The description adds minimal value beyond the schema: it implies format support ('Supports multiple formats') and JavaScript capability, but doesn't explain parameter interactions or provide additional semantic context. Baseline 3 is appropriate when the schema does the heavy lifting.

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: 'Extract content from a single URL' specifies the verb and resource. It distinguishes from sibling 'batch_scrape_urls' by emphasizing 'single URL' and from 'get_webpage_content' by mentioning format support and JavaScript rendering. However, it doesn't explicitly contrast with all siblings like 'google_search' or 'search_web'.

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 implies usage context through 'single URL' (vs. batch) and 'JavaScript rendering' (for dynamic content), but doesn't provide explicit when-to-use guidance or alternatives. It mentions 'Supports multiple formats' which suggests format flexibility, but no clear exclusions or comparisons to siblings like 'get_webpage_content' 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

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