research
Utilize this tool to perform in-depth web research by sending queries to You.com's Research API, with optional custom instructions for tailored results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instructions | No | Custom instructions for tailoring the response (optional) | |
| query | Yes | The research query to send to You.com's Research API |
Implementation Reference
- src/index.ts:89-108 (handler)The handler function for the 'research' MCP tool. It invokes youClient.research with the query and optional instructions, formats the result as text content, and handles errors appropriately.async ({ query, instructions }: { query: string; instructions?: string }) => { try { const result = await youClient.research(query, instructions); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { console.error("Research error:", error); return { content: [{ type: "text", text: `Error performing research: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/index.ts:85-88 (schema)Zod input schema for the 'research' tool defining the required 'query' parameter and optional 'instructions'.{ query: z.string().describe("The research query to send to You.com's Research API"), instructions: z.string().optional().describe("Custom instructions for tailoring the response (optional)") },
- src/index.ts:83-109 (registration)Registration of the 'research' tool on the MCP server using server.tool(), including schema and handler.server.tool( "research", { query: z.string().describe("The research query to send to You.com's Research API"), instructions: z.string().optional().describe("Custom instructions for tailoring the response (optional)") }, async ({ query, instructions }: { query: string; instructions?: string }) => { try { const result = await youClient.research(query, instructions); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { console.error("Research error:", error); return { content: [{ type: "text", text: `Error performing research: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/services/youApiClient.ts:117-139 (helper)Helper method in YouApiClient class that performs the actual API call to You.com's '/research' endpoint, used by the tool handler./** * Get a citation-backed response using You.com Research API */ async research( query: string, instructions?: string ): Promise<ResearchResult> { try { const params: Record<string, string> = { query: query }; if (instructions) { params.instructions = instructions; } const response = await this.chatClient.get('/research', { params }); return response.data; } catch (error) { console.error('Error in You.com research API call:', error); throw error; } }
- src/services/youApiClient.ts:19-26 (schema)TypeScript interface defining the structure of the response from the You.com Research API.interface ResearchResult { answer: string; citations: Array<{ url: string; title: string; content: string; }>; }