Skip to main content
Glama

firecrawl_process

Extract web content through scraping, crawling, mapping, or structured data extraction to process URLs and discover information.

Instructions

Extract web content with Firecrawl. Modes: scrape (single page), crawl (deep crawl), map (URL discovery), extract (structured data), actions (interactive).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL(s)
modeYesProcessing mode
extract_depthNoExtraction depth

Implementation Reference

  • MCP server tool registration and handler for 'firecrawl_process'. Defines the tool schema, description, and execution logic that delegates to the UnifiedFirecrawlProcessingProvider's process_content method.
    server.tool(
    	{
    		name: 'firecrawl_process',
    		description: this.firecrawl_process_provider.description,
    		schema: v.object({
    			url: v.pipe(
    				v.union([v.string(), v.array(v.string())]),
    				v.description('URL(s)'),
    			),
    			mode: v.pipe(
    				v.union([
    					v.literal('scrape'),
    					v.literal('crawl'),
    					v.literal('map'),
    					v.literal('extract'),
    					v.literal('actions'),
    				]),
    				v.description('Processing mode'),
    			),
    			extract_depth: v.optional(
    				v.pipe(
    					v.union([v.literal('basic'), v.literal('advanced')]),
    					v.description('Extraction depth'),
    				),
    			),
    		}),
    	},
    	async ({ url, mode, extract_depth }) => {
    		try {
    			const result =
    				await this.firecrawl_process_provider!.process_content(
    					url,
    					extract_depth,
    					mode as any,
    				);
    			const safe_result = handle_large_result(
    				result,
    				'firecrawl_process',
    			);
    			return {
    				content: [
    					{
    						type: 'text' as const,
    						text: JSON.stringify(safe_result, null, 2),
    					},
    				],
    			};
    		} catch (error) {
    			const error_response = create_error_response(
    				error as Error,
    			);
    			return {
    				content: [
    					{
    						type: 'text' as const,
    						text: error_response.error,
    					},
    				],
    				isError: true,
    			};
    		}
    	},
    );
  • Core handler logic in UnifiedFirecrawlProvider.process_content. Selects sub-provider based on mode (scrape/crawl/etc.) and delegates processing.
    async process_content(
    	url: string | string[],
    	extract_depth: 'basic' | 'advanced' = 'basic',
    	mode: FirecrawlMode = 'scrape',
    ): Promise<ProcessingResult> {
    	if (!mode) {
    		throw new ProviderError(
    			ErrorType.INVALID_INPUT,
    			'Mode parameter is required',
    			this.name,
    		);
    	}
    
    	const selectedProvider = this.providers.get(mode);
    
    	if (!selectedProvider) {
    		throw new ProviderError(
    			ErrorType.INVALID_INPUT,
    			`Invalid mode: ${mode}. Valid options: ${Array.from(this.providers.keys()).join(', ')}`,
    			this.name,
    		);
    	}
    
    	return selectedProvider.process_content(url, extract_depth);
    }
  • Valibot schema defining input parameters for the 'firecrawl_process' tool: url, mode, extract_depth.
    schema: v.object({
    	url: v.pipe(
    		v.union([v.string(), v.array(v.string())]),
    		v.description('URL(s)'),
    	),
    	mode: v.pipe(
    		v.union([
    			v.literal('scrape'),
    			v.literal('crawl'),
    			v.literal('map'),
    			v.literal('extract'),
    			v.literal('actions'),
    		]),
    		v.description('Processing mode'),
    	),
    	extract_depth: v.optional(
    		v.pipe(
    			v.union([v.literal('basic'), v.literal('advanced')]),
    			v.description('Extraction depth'),
    		),
    	),
    }),
  • TypeScript interface defining the contract for the firecrawl_process provider, including process_content signature.
    export interface UnifiedFirecrawlProcessingProvider {
    	name: string;
    	description: string;
    	process_content(
    		url: string | string[],
    		extract_depth?: 'basic' | 'advanced',
    		mode?: FirecrawlMode,
    	): Promise<ProcessingResult>;
    }
  • Registers the UnifiedFirecrawlProvider instance if any Firecrawl API key is valid, enabling the 'firecrawl_process' tool.
    if (has_firecrawl) {
    	register_firecrawl_process_provider(
    		new UnifiedFirecrawlProvider(),
    	);
    }

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/spences10/mcp-omnisearch'

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