Skip to main content
Glama
malaksedarous

Context Optimizer MCP Server

researchTopic

Conduct focused web research on software development topics to obtain current information and practical implementation guidance using advanced search capabilities.

Instructions

Conduct quick, focused web research on software development topics using Exa.ai's powerful research capabilities for current information and practical implementation guidance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesThe research topic or problem you want to investigate. Be as detailed as possible about what you want to learn, any specific aspects to focus on, timeframes, geographical scope, or particular angles of interest.

Implementation Reference

  • The execute method of ResearchTopicTool class, which is the main handler for the 'researchTopic' tool. It validates input, checks Exa.ai API key configuration, logs operations, calls the research helper, and returns success or error 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 ResearchTopicInput; // 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 quick research for topic: ${input.topic}`); // Conduct research const result = await this.conductQuickResearch(input.topic, config.research.exaKey); this.logOperation('Quick research completed successfully'); return this.createSuccessResponse(result.result); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.logOperation(`Research failed: ${errorMessage}`); return this.createErrorResponse(`Research failed: ${errorMessage}`); } }
  • JSON Schema definition for the 'researchTopic' tool input parameters, defining the required 'topic' string field 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. Be as detailed as possible about what you want to learn, any specific aspects to focus on, timeframes, geographical scope, or particular angles of interest.' } }, required: ['topic'] };
  • src/server.ts:60-74 (registration)
    Server setup method that instantiates ResearchTopicTool and registers it in the tools Map, making it available for MCP listTools and callTool requests.
    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(', ')}`); }
  • Private helper method implementing the core research logic: initializes Exa client, creates research task with specific schema and model, polls for completion, formats response, and handles errors.
    private async conductQuickResearch(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 research task'); const task = await research.create({ instructions: topic, model: RESEARCH_CONFIG.QUICK_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.QUICK_RESEARCH.MAX_ATTEMPTS, RESEARCH_CONFIG.QUICK_RESEARCH.POLL_INTERVAL_MS, RESEARCH_CONFIG.QUICK_RESEARCH.TIMEOUT_MS ); return this.formatResponse(result); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Failed to conduct research with Exa.ai.'; throw new Error(`Exa.ai research failed: ${errorMessage}`); } }

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/malaksedarous/context-optimizer-mcp-server'

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