retrieve_mcps
Retrieve MCPs from the mcp-registry-server using a query. Access the registry for quick and accurate results based on specified search terms.
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)Executes the 'retrieve_mcps' tool: extracts query from arguments, calls retrieveContext helper, and returns formatted response or error.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)Defines the tool metadata, name, description, and input schema requiring a 'query' string.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)Registers the 'retrieve_mcps' tool (as RETRIEVAL_TOOL) in the server's list of available tools.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [RETRIEVAL_TOOL], }));
- index.ts:21-56 (helper)Core helper function that performs RAG retrieval by POSTing the query to an AWS Lambda URL and returns ragSources or error status.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: [] }; } }