retrieve_mcps
Search the MCP registry using natural language queries to find relevant MCP servers for your projects.
Instructions
Performs retrieval from our registry of MCPs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The query to perform retrieval on |
Implementation Reference
- index.ts:92-112 (handler)Handler logic for the 'retrieve_mcps' tool within the CallToolRequestSchema request handler. It extracts the query argument, calls the retrieveContext helper, and returns the RAG sources or error messages.if (name === "retrieve_mcps") { const { query } = args as Record<string, any>; try { const result = await retrieveContext(query); if (result.isRagWorking) { return { content: [ { type: "text", text: `RAG Sources: ${JSON.stringify(result.ragSources)}` }, ], }; } else { return { content: [{ type: "text", text: "Retrieval failed or returned no results." }], }; } } catch (error) { return { content: [{ type: "text", text: `Error occurred: ${error}` }], }; } } else {
- index.ts:59-69 (schema)Tool definition including name, description, and input schema for 'retrieve_mcps'. This is used for tool listing and validation.const RETRIEVAL_TOOL: Tool = { name: "retrieve_mcps", description: "Performs retrieval from our registry of MCPs.", inputSchema: { type: "object", properties: { query: { type: "string", description: "The query to perform retrieval on" }, }, required: ["query"] }, };
- index.ts:85-87 (registration)Registration of the 'retrieve_mcps' tool in the ListToolsRequestSchema handler, making it discoverable by clients.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [RETRIEVAL_TOOL], }));
- index.ts:21-56 (helper)Helper function that performs the actual retrieval by calling a Lambda URL with the query and returns RAG sources.async function retrieveContext( query: string, ): Promise<{ isRagWorking: boolean; ragSources: RAGSource[]; }> { try { if (!query) { console.error("Query was not provided"); return { isRagWorking: false, ragSources: [], }; } const input = { queryStringParameters: {query: query}}; // Call the Lambda URL with the input const response = await fetch("https://r3swscwlse4zxx5zqhm7vwij740xcooe.lambda-url.us-east-1.amazonaws.com/", { method: "POST", body: JSON.stringify(input), agent: httpsAgent, }, ).then((res: { json: () => any; }) => res.json()); const ragSources = response return { isRagWorking: true, ragSources, }; } catch (error) { console.error("RAG Error:", error); return { isRagWorking: false, ragSources: [] }; } }