firecrawl_deep_research
Conduct comprehensive web research by crawling, searching, and analyzing content to gather detailed information on any topic.
Instructions
Conduct deep research on a query using web crawling, search, and AI analysis.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The query to research | |
| maxDepth | No | Maximum depth of research iterations (1-10) | |
| timeLimit | No | Time limit in seconds (30-300) | |
| maxUrls | No | Maximum number of URLs to analyze (1-1000) |
Implementation Reference
- src/index.ts:1274-1337 (handler)The main handler function for the 'firecrawl_deep_research' tool. Validates input arguments, calls the Firecrawl client's deepResearch method with query and optional parameters (maxDepth, timeLimit, maxUrls), uses callbacks to log research activities and sources, handles the response by returning the finalAnalysis, and includes error handling.case 'firecrawl_deep_research': { if (!args || typeof args !== 'object' || !('query' in args)) { throw new Error('Invalid arguments for firecrawl_deep_research'); } try { const researchStartTime = Date.now(); server.sendLoggingMessage({ level: 'info', data: `Starting deep research for query: ${args.query}`, }); const response = await client.deepResearch( args.query as string, { maxDepth: args.maxDepth as number, timeLimit: args.timeLimit as number, maxUrls: args.maxUrls as number, }, // Activity callback (activity) => { server.sendLoggingMessage({ level: 'info', data: `Research activity: ${activity.message} (Depth: ${activity.depth})`, }); }, // Source callback (source) => { server.sendLoggingMessage({ level: 'info', data: `Research source found: ${source.url}${source.title ? ` - ${source.title}` : ''}`, }); } ); // Log performance metrics server.sendLoggingMessage({ level: 'info', data: `Deep research completed in ${Date.now() - researchStartTime}ms`, }); if (!response.success) { throw new Error(response.error || 'Deep research failed'); } // Format the results const formattedResponse = { finalAnalysis: response.data.finalAnalysis, activities: response.data.activities, sources: response.data.sources, }; return { content: [{ type: 'text', text: formattedResponse.finalAnalysis }], isError: false, }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorMessage }], isError: true, }; } }
- src/index.ts:524-549 (schema)Defines the Tool metadata including name, description, and detailed inputSchema with properties for query (required), maxDepth, timeLimit, and maxUrls.const DEEP_RESEARCH_TOOL: Tool = { name: 'firecrawl_deep_research', description: 'Conduct deep research on a query using web crawling, search, and AI analysis.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'The query to research', }, maxDepth: { type: 'number', description: 'Maximum depth of research iterations (1-10)', }, timeLimit: { type: 'number', description: 'Time limit in seconds (30-300)', }, maxUrls: { type: 'number', description: 'Maximum number of URLs to analyze (1-1000)', } }, required: ['query'], }, };
- src/index.ts:863-873 (registration)Registers the firecrawl_deep_research tool (as DEEP_RESEARCH_TOOL) in the list of available tools returned by the ListToolsRequestSchema handler.tools: [ SCRAPE_TOOL, MAP_TOOL, CRAWL_TOOL, BATCH_SCRAPE_TOOL, CHECK_BATCH_STATUS_TOOL, CHECK_CRAWL_STATUS_TOOL, SEARCH_TOOL, EXTRACT_TOOL, DEEP_RESEARCH_TOOL, ],