smart_search
Search the web, retrieve news, and conduct research using query-based inputs, with optional custom instructions and conversation continuity for tailored results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conversationId | No | A hex UUID to maintain conversation continuity (optional) | |
| instructions | No | Custom instructions for tailoring the response (optional) | |
| query | Yes | The query to send to You.com's Smart API |
Implementation Reference
- src/index.ts:53-80 (registration)MCP server registration for the 'smart_search' tool, including Zod input schema, error-handling wrapper, and delegation to YouApiClient.smartSearchserver.tool( "smart_search", { query: z.string().describe("The query to send to You.com's Smart API"), instructions: z.string().optional().describe("Custom instructions for tailoring the response (optional)"), conversationId: z.string().optional().describe("A hex UUID to maintain conversation continuity (optional)") }, async ({ query, instructions, conversationId }: { query: string; instructions?: string; conversationId?: string }) => { try { const result = await youClient.smartSearch(query, instructions, conversationId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { console.error("Smart search error:", error); return { content: [{ type: "text", text: `Error performing smart search: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/services/youApiClient.ts:91-115 (handler)Core handler function in YouApiClient that performs the actual HTTP request to You.com's '/smart' API endpoint for AI-powered searchasync smartSearch( query: string, instructions?: string, conversationId?: string ): Promise<SmartResult> { try { const params: Record<string, string> = { query: query }; if (instructions) { params.instructions = instructions; } if (conversationId) { params.conversation_id = conversationId; } const response = await this.chatClient.get('/smart', { params }); return response.data; } catch (error) { console.error('Error in You.com smart API call:', error); throw error; } }
- src/services/youApiClient.ts:10-17 (schema)TypeScript interface defining the expected output structure of the smartSearch API responseinterface SmartResult { answer: string; results: Array<{ url: string; title: string; snippet: string; }>; }
- src/index.ts:56-59 (schema)Zod schema defining the input parameters for the smart_search MCP toolquery: z.string().describe("The query to send to You.com's Smart API"), instructions: z.string().optional().describe("Custom instructions for tailoring the response (optional)"), conversationId: z.string().optional().describe("A hex UUID to maintain conversation continuity (optional)") },