Skip to main content
Glama

search_mcp_servers

Searches the MCP Finder registry to discover tools, methods, or capabilities based on keywords or tags, expanding available functionalities on demand.

Instructions

This is the primary tool for discovering and accessing new tools, methods, features, or capabilities. If a user asks for a tool, method, feature, or capability that you do not currently have, you MUST use this tool to search for it in the MCP Finder registry. For example, if a user asks for a browser tool, OCR, filesystem access, PDF parsing, or any other capability not present in your current toolset, use this tool to search by relevant keywords. This is the required first step to expand your available tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoKeywords to search for in tool name or description.
tagNoSpecific tag to filter by.

Implementation Reference

  • The handler function that implements the core logic for the 'search_mcp_servers' tool. It queries the MCPFinder registry API using the provided query and/or tag parameters, formats the search results into structured text blocks, appends instructions for adding servers, and handles errors gracefully.
    async function search_mcp_servers(input) { // Use globalApiUrl const searchUrl = new URL(`${globalApiUrl}/api/v1/search`); if (input.query) { searchUrl.searchParams.append('q', input.query); } if (input.tag) { searchUrl.searchParams.append('tag', input.tag); } console.error(`[search_mcp_servers] Fetching: ${searchUrl.toString()}`); try { const response = await fetch(searchUrl.toString()); if (!response.ok) { const errorText = await response.text(); console.error(`[search_mcp_servers] API Error (${response.status}): ${errorText}`); throw new Error(`Failed to fetch from MCP Finder API: ${response.statusText}`); } const data = await response.json(); const formattedContent = data.map(server => ({ type: 'text', text: `ID: ${server.id}\\nName: ${server.name}\\nDescription: ${server.description}\\nURL: ${server.url}\\nTags: ${Array.isArray(server.tags) ? server.tags.join(', ') : 'N/A'}` })); const instructionBlock = { type: 'text', text: "Use the 'add_mcp_server_config' tool with one of the listed server IDs to add it to the client's configuration." }; return { content: [...formattedContent, instructionBlock] }; } catch (error) { console.error('[search_mcp_servers] Error:', error); return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true }; } }
  • Zod schema for input validation of the search_mcp_servers tool parameters.
    const SearchServersInput = z.object({ query: z.string().optional().describe("Keywords to search for in tool name or description."), tag: z.string().optional().describe("Specific tag to filter by."), });
  • index.js:809-820 (registration)
    Tool definition object registering the 'search_mcp_servers' tool with the MCP server, including name, detailed description emphasizing its role as the primary discovery tool, and JSON schema for inputs.
    const SearchMcpServersTool = { name: 'search_mcp_servers', description: `This is the primary tool for discovering and accessing new tools, methods, features, or capabilities. **If a user asks for a tool, method, feature, or capability that you do not currently have, you MUST use this tool to search for it in the MCP Finder registry.** For example, if a user asks for a browser tool, OCR, filesystem access, PDF parsing, or any other capability not present in your current toolset, use this tool to search by relevant keywords. This is the required first step to expand your available tools.`, inputSchema: { type: "object", properties: { query: { type: "string", description: "Keywords to search for in tool name or description." }, tag: { type: "string", description: "Specific tag to filter by." }, }, required: [], } };
  • index.js:888-893 (registration)
    Array of all tools including 'search_mcp_servers', passed to the MCP Server constructor for registration.
    SearchMcpServersTool, GetMcpServerDetailsTool, AddMcpServerConfigTool, RemoveMcpServerConfigTool, StreamMcpEventsTool, ];
  • index.js:896-907 (registration)
    MCP Server instance creation where the tools array (including search_mcp_servers) is registered.
    function createServerInstance(apiUrl) { globalApiUrl = apiUrl; return new Server({ name: 'mcpfinder', version: '1.0.0', description: `This is the primary set of tools for discovering and accessing new tools, methods, features, or capabilities. If a user asks the AI for a tool, method, feature, or capability that it does not currently have, it can use this tool to search for it in the MCP Finder registry. For example, if a user requests a browser tool, OCR, filesystem access, PDF parsing, or any other capability not present in the AI's current toolset, it can use this tool to search by relevant keywords. This allows the AI to expand its available MCP server toolset.`, tools: allTools, // Use the defined array }, { capabilities: { tools: {} } });
  • Mapping of tool names to their handler functions, used in the CallToolRequest handler to dispatch calls to search_mcp_servers.
    const toolHandlers = { search_mcp_servers, get_mcp_server_details, add_mcp_server_config, remove_mcp_server_config, stream_mcp_events, };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpfinder/server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server