deepResearch
Conduct comprehensive research using exhaustive analysis capabilities for critical decision-making and complex architectural planning.
Instructions
Conduct comprehensive, in-depth research using Exa.ai's exhaustive analysis capabilities for critical decision-making and complex architectural planning.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | The research topic or problem you want to investigate comprehensively. Be as detailed as possible about what you want to learn, including technical requirements, architectural considerations, performance needs, security concerns, or strategic implications you want analyzed in depth. |
Implementation Reference
- src/tools/deepResearch.ts:32-69 (handler)The main execute method that handles input validation, configuration retrieval, invokes the deep research logic, and returns the MCP tool response.async execute(args: any): Promise<MCPToolResponse> { try { // Validate input const validationError = this.validateRequiredFields(args, ['topic']); if (validationError) { return this.createErrorResponse(validationError); } const input = args as DeepResearchInput; // Validate topic is not empty if (!input.topic.trim()) { return this.createErrorResponse('Topic cannot be empty'); } // Get configuration const config = ConfigurationManager.getConfig(); if (!config.research.exaKey) { return this.createErrorResponse( 'Exa.ai API key is not configured. Please set the exaKey in your configuration or EXA_KEY environment variable.' ); } this.logOperation(`Starting deep research for topic: ${input.topic}`); // Conduct research const result = await this.conductDeepResearch(input.topic, config.research.exaKey); this.logOperation('Deep research completed successfully'); return this.createSuccessResponse(result.result); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.logOperation(`Deep research failed: ${errorMessage}`); return this.createErrorResponse(`Research failed: ${errorMessage}`); } }
- src/tools/deepResearch.ts:21-30 (schema)Input schema definition specifying the required 'topic' string parameter with detailed description.readonly inputSchema = { type: 'object' as const, properties: { topic: { type: 'string' as const, description: 'The research topic or problem you want to investigate comprehensively. Be as detailed as possible about what you want to learn, including technical requirements, architectural considerations, performance needs, security concerns, or strategic implications you want analyzed in depth.' } }, required: ['topic'] };
- src/server.ts:60-74 (registration)Registers DeepResearchTool instance along with other tools in the server's tools Map during initialization.private setupTools(): void { const toolInstances = [ new AskAboutFileTool(), new RunAndExtractTool(), new AskFollowUpTool(), new ResearchTopicTool(), new DeepResearchTool() ]; for (const tool of toolInstances) { this.tools.set(tool.name, tool); } Logger.info(`Registered ${this.tools.size} tools: ${Array.from(this.tools.keys()).join(', ')}`); }
- src/tools/deepResearch.ts:71-110 (helper)Core helper method that interacts with Exa.ai API: creates research task with specific model and schema, polls for completion using config values, and formats the response.private async conductDeepResearch(topic: string, exaKey: string): Promise<ExaResponse> { const client = new Exa(exaKey); try { const schema = { type: 'object' as const, properties: { result: { type: 'string' as const } }, required: ['result'], description: 'Schema with just the result in markdown.' }; if (!client?.research || typeof (client as any).research.create !== 'function') { throw new Error('Exa.js research client missing create() method'); } const research: any = (client as any).research; this.logOperation('Creating Exa deep research task'); const task = await research.create({ instructions: topic, model: RESEARCH_CONFIG.DEEP_RESEARCH.MODEL, output: { schema }, }); this.logOperation(`Task created with ID: ${task.id}. Polling for results...`); const result = await this.pollTaskWithFallback( client, task.id, RESEARCH_CONFIG.DEEP_RESEARCH.MAX_ATTEMPTS, RESEARCH_CONFIG.DEEP_RESEARCH.POLL_INTERVAL_MS, RESEARCH_CONFIG.DEEP_RESEARCH.TIMEOUT_MS ); return this.formatResponse(result); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Failed to conduct deep research with Exa.ai.'; throw new Error(`Exa.ai deep research failed: ${errorMessage}`); } }
- src/config/constants.ts:15-20 (helper)Configuration constants for deep research polling behavior, max attempts, timeout, and model used in the tool implementation.DEEP_RESEARCH: { POLL_INTERVAL_MS: 15000, // 15 seconds MAX_ATTEMPTS: 20, // 20 attempts = 300 seconds total TIMEOUT_MS: 350000, // 350 seconds MODEL: 'exa-research-pro' }