firecrawl_extract
Extract structured data from web pages using LLM capabilities. Define specific information to retrieve like product details or pricing through custom prompts and schemas.
Instructions
Extract structured information from web pages using LLM capabilities. Supports both cloud AI and self-hosted LLM extraction.
Best for: Extracting specific structured data like prices, names, details from web pages. Not recommended for: When you need the full content of a page (use scrape); when you're not looking for specific structured data. Arguments:
urls: Array of URLs to extract information from
prompt: Custom prompt for the LLM extraction
schema: JSON schema for structured data extraction
allowExternalLinks: Allow extraction from external links
enableWebSearch: Enable web search for additional context
includeSubdomains: Include subdomains in extraction Prompt Example: "Extract the product name, price, and description from these product pages." Usage Example:
Returns: Extracted structured data as defined by your schema.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes | ||
| prompt | No | ||
| schema | No | ||
| allowExternalLinks | No | ||
| enableWebSearch | No | ||
| includeSubdomains | No |
Implementation Reference
- src/index.ts:597-617 (handler)The handler function for 'firecrawl_extract' tool. It uses the Firecrawl client to perform extraction on provided URLs using the specified prompt and schema, cleans parameters, logs activity, and returns JSON-formatted results.execute: async ( args: unknown, { session, log }: { session?: SessionData; log: Logger } ): Promise<string> => { const client = getClient(session); const a = args as Record<string, unknown>; log.info('Extracting from URLs', { count: Array.isArray(a.urls) ? a.urls.length : 0, }); const extractBody = removeEmptyTopLevel({ urls: a.urls as string[], prompt: a.prompt as string | undefined, schema: (a.schema as Record<string, unknown>) || undefined, allowExternalLinks: a.allowExternalLinks as boolean | undefined, enableWebSearch: a.enableWebSearch as boolean | undefined, includeSubdomains: a.includeSubdomains as boolean | undefined, origin: ORIGIN, }); const res = await client.extract(extractBody as any); return asText(res); },
- src/index.ts:589-596 (schema)Zod input schema for the 'firecrawl_extract' tool, defining required URLs array and optional fields for extraction prompt, JSON schema, and crawling options.parameters: z.object({ urls: z.array(z.string()), prompt: z.string().optional(), schema: z.record(z.string(), z.any()).optional(), allowExternalLinks: z.boolean().optional(), enableWebSearch: z.boolean().optional(), includeSubdomains: z.boolean().optional(), }),
- src/index.ts:550-551 (registration)Registration of the 'firecrawl_extract' tool using server.addTool, specifying name, description, parameters, and handler.server.addTool({ name: 'firecrawl_extract',