investigate
Analyze topics and questions in detail using configurable depth levels, with optional web search integration, leveraging AI models like OpenAI and Gemini via the Ultra MCP server.
Instructions
Investigate topics thoroughly with configurable depth
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Investigation depth | deep |
| enableSearch | No | Enable web search for investigation (Gemini only) | |
| model | No | Specific model to use | |
| provider | No | AI provider to use (defaults to Azure if configured, otherwise best available) | |
| topic | Yes | The topic or question to investigate |
Implementation Reference
- src/handlers/ai-tools.ts:178-220 (handler)The main execution logic for the 'investigate' tool. Selects AI provider, constructs depth-specific prompts and system prompt for investigation, generates response using provider.generateText, and formats output for MCP protocol.async handleInvestigation(params: z.infer<typeof InvestigationSchema>) { // Use provided provider or get the preferred one (Azure if configured) const providerName = params.provider || (await this.providerManager.getPreferredProvider(['openai', 'gemini', 'azure', 'grok'])); const provider = await this.providerManager.getProvider(providerName); // Build investigation prompts based on depth const depthPrompts = { shallow: "Provide a brief overview and key points about", medium: "Investigate and analyze the following topic, covering main aspects and implications", deep: "Conduct a thorough investigation of the following topic, exploring all relevant angles, implications, evidence, and potential conclusions. Be comprehensive and systematic", }; const systemPrompt = `You are an expert investigator and analyst. Your task is to thoroughly investigate topics, gather relevant information, analyze patterns, and provide comprehensive insights. ${params.provider === "gemini" && params.enableSearch ? "Use web search to find current and relevant information." : ""}`; const prompt = `${depthPrompts[params.depth]}: ${params.topic}`; const response = await provider.generateText({ prompt, model: params.model, systemPrompt, reasoningEffort: (providerName === "openai" || providerName === "azure" || providerName === "grok") ? "high" : undefined, useSearchGrounding: providerName === "gemini" ? (params.enableSearch !== false) : false, temperature: 0.5, // Lower temperature for investigation }); return { content: [ { type: "text", text: response.text, }, ], metadata: { provider: providerName, model: response.model, investigationDepth: params.depth, usage: response.usage, ...response.metadata, }, }; }
- src/server.ts:255-262 (registration)Registers the 'investigate' MCP tool with title, description, input schema, and handler function that invokes AIToolHandlers.handleInvestigation via lazy-loaded getHandlers().server.registerTool("investigate", { title: "Investigate", description: "Investigate topics thoroughly with configurable depth", inputSchema: InvestigationSchema.shape, }, async (args) => { const aiHandlers = await getHandlers(); return await aiHandlers.handleInvestigation(args); });
- src/handlers/ai-tools.ts:17-23 (schema)Zod input schema validation for the 'investigate' tool, defining parameters like provider, required topic, depth (default 'deep'), optional model, and enableSearch.const InvestigationSchema = z.object({ provider: z.enum(["openai", "gemini", "azure", "grok"]).optional().describe("AI provider to use (defaults to Azure if configured, otherwise best available)"), topic: z.string().describe("The topic or question to investigate"), depth: z.enum(["shallow", "medium", "deep"]).default("deep").describe("Investigation depth"), model: z.string().optional().describe("Specific model to use"), enableSearch: z.boolean().optional().default(true).describe("Enable web search for investigation (Gemini only)"), });