Skip to main content
Glama

scrape_url

Extract HTML content from any URL by integrating with the ReviewWebsite API. Specify a URL, optional delay, and API key to retrieve web page data programmatically.

Instructions

Scrape a URL and return HTML content using ReviewWeb.site API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoYour ReviewWebsite API key
delayAfterLoadNoOptional delay after page load in milliseconds
urlYesThe URL to scrape

Implementation Reference

  • MCP tool handler function that receives args, calls the controller's scrapeUrl, formats the response as MCP content or error.
    async function handleScrapeUrl(args: ScrapeUrlToolArgsType) {
    	const methodLogger = Logger.forContext(
    		'tools/reviewwebsite.tool.ts',
    		'handleScrapeUrl',
    	);
    	methodLogger.debug(`Scraping URL with options:`, {
    		...args,
    		api_key: args.api_key ? '[REDACTED]' : undefined,
    	});
    
    	try {
    		const result = await reviewWebsiteController.scrapeUrl(
    			args.url,
    			args.delayAfterLoad,
    			{
    				api_key: args.api_key,
    			},
    		);
    
    		return {
    			content: [
    				{
    					type: 'text' as const,
    					text: result.content,
    				},
    			],
    		};
    	} catch (error) {
    		methodLogger.error(`Error scraping URL`, error);
    		return formatErrorForMcpTool(error);
    	}
    }
  • Zod schema defining the input parameters for the scrape_url tool: url (required), delayAfterLoad (optional number), api_key (optional string).
    export const ScrapeUrlToolArgs = z.object({
    	url: z.string().describe('The URL to scrape'),
    	delayAfterLoad: z
    		.number()
    		.optional()
    		.describe('Optional delay after page load in milliseconds'),
    	api_key: z.string().optional().describe('Your ReviewWebsite API key'),
    });
  • Registration of the scrape_url tool with the MCP server, providing name, description, input schema, and handler reference.
    server.tool(
    	'scrape_url',
    	`Scrape a URL and return HTML content using ReviewWeb.site API.`,
    	ScrapeUrlToolArgs.shape,
    	handleScrapeUrl,
    );
  • Core service implementation that performs the HTTP POST request to the ReviewWebsite API /scrape endpoint to fetch HTML content.
    async function scrapeUrl(
    	url: string,
    	delayAfterLoad?: number,
    	apiKey?: string,
    ): Promise<any> {
    	const methodLogger = Logger.forContext(
    		'services/vendor.reviewwebsite.service.ts',
    		'scrapeUrl',
    	);
    
    	try {
    		methodLogger.debug('Scraping URL', { url, delayAfterLoad });
    
    		const params = new URLSearchParams();
    		params.append('url', url);
    
    		const response = await axios.post(
    			`${API_BASE}/scrape`,
    			{
    				options: {
    					delayAfterLoad,
    				},
    			},
    			{
    				params,
    				headers: getHeaders(apiKey),
    			},
    		);
    
    		methodLogger.debug('Successfully scraped URL');
    		return response.data;
    	} catch (error) {
    		return handleApiError(error, 'scrapeUrl');
    	}
    }
  • Controller layer function that resolves API key, calls the service, formats JSON response, and handles errors.
    async function scrapeUrl(
    	url: string,
    	delayAfterLoad?: number,
    	options: ReviewWebsiteOptions = {},
    ): Promise<ControllerResponse> {
    	const methodLogger = Logger.forContext(
    		'controllers/reviewwebsite.controller.ts',
    		'scrapeUrl',
    	);
    
    	methodLogger.debug('Scraping URL', { url, delayAfterLoad });
    
    	try {
    		const apiKey = getApiKey(options);
    		const result = await reviewWebsiteService.scrapeUrl(
    			url,
    			delayAfterLoad,
    			apiKey,
    		);
    
    		return {
    			content: JSON.stringify(result, null, 2),
    		};
    	} catch (error) {
    		return handleControllerError(error, {
    			entityType: 'URL',
    			operation: 'scraping',
    			source: 'controllers/reviewwebsite.controller.ts@scrapeUrl',
    			additionalInfo: { url },
    		});
    	}
    }
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 the API provider ('ReviewWeb.site') but doesn't describe rate limits, authentication requirements beyond the api_key parameter, error handling, or what happens with invalid URLs. For a web scraping tool with external dependencies, 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 states the action, target, and return value. Every word earns its place with no redundancy or unnecessary elaboration. It's appropriately sized for a straightforward scraping tool.

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?

For a web scraping tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format the HTML content returns in, how errors are handled, rate limits, or authentication requirements. Given the complexity of web scraping and the lack of structured metadata, more behavioral context is needed.

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 three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions 'using ReviewWeb.site API' which contextualizes the api_key parameter, but this is minimal added value.

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 ('scrape') and resource ('URL'), and specifies the return type ('HTML content'). It distinguishes itself from siblings by focusing on raw HTML scraping rather than conversion, extraction, or analysis. However, it doesn't explicitly contrast with all siblings like 'url_get_after_redirects' or 'url_is_alive'.

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 doesn't mention when to choose scraping over other URL-related tools like 'extract_data', 'summarize_url', or 'url_get_after_redirects'. There are no usage prerequisites, exclusions, or comparisons with sibling tools.

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

Related 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/mrgoonie/reviewwebsite-mcp-server'

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