search
Search across 100+ MCP tools and custom integrations through a unified gateway to find specific tools by name or keywords.
Instructions
search tool
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | The query to search the tools by name or keywords | |
| limit | No | The limit of results to return |
Implementation Reference
- src/tools/search.ts:10-59 (handler)Handler function that executes the 'search' tool logic: calls client.searchTools, formats the results into a numbered list with parameters, handles empty results and errors.handler: async (args: any, client: GatewayClient) => { try { const tools = await client.searchTools(args.query || ''); if (tools.length === 0) { return { content: [{ type: 'text' as const, text: args.query ? `No tools found matching "${args.query}".` : 'No tools available.', }], }; } // Format tools list const toolsList = tools.map((tool, index) => { const params = tool.inputSchema.properties ? Object.keys(tool.inputSchema.properties) .map(key => { const prop = tool.inputSchema.properties![key]; const required = tool.inputSchema.required?.includes(key) ? ' (required)' : ''; return ` - ${key}${required}: ${prop.description || prop.type}`; }) .join('\n') : ' No parameters'; return `${index + 1}. **${tool.name}**\n ${tool.description}\n Parameters:\n${params}`; }).join('\n\n'); const summary = args.query ? `Found ${tools.length} tool(s) matching "${args.query}":` : `Available tools (${tools.length}):`; return { content: [{ type: 'text' as const, text: `${summary}\n\n${toolsList}`, }], }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error searching tools: ${error instanceof Error ? error.message : 'Unknown error'}`, }], isError: true, }; } },
- src/tools/search.ts:7-9 (schema)Input schema for the 'search' tool using Zod: optional 'query' string.inputSchema: z.object({ query: z.string().optional().describe('Search term to filter tools by name or description. Leave empty to list all available tools.'), }),
- src/tools/search.ts:4-60 (handler)Full tool definition including name 'search', description, inputSchema, and handler.export const searchTool = { name: 'search', description: 'Search and discover available tools across all connected MCP servers. Returns a list of tools matching your search query.', inputSchema: z.object({ query: z.string().optional().describe('Search term to filter tools by name or description. Leave empty to list all available tools.'), }), handler: async (args: any, client: GatewayClient) => { try { const tools = await client.searchTools(args.query || ''); if (tools.length === 0) { return { content: [{ type: 'text' as const, text: args.query ? `No tools found matching "${args.query}".` : 'No tools available.', }], }; } // Format tools list const toolsList = tools.map((tool, index) => { const params = tool.inputSchema.properties ? Object.keys(tool.inputSchema.properties) .map(key => { const prop = tool.inputSchema.properties![key]; const required = tool.inputSchema.required?.includes(key) ? ' (required)' : ''; return ` - ${key}${required}: ${prop.description || prop.type}`; }) .join('\n') : ' No parameters'; return `${index + 1}. **${tool.name}**\n ${tool.description}\n Parameters:\n${params}`; }).join('\n\n'); const summary = args.query ? `Found ${tools.length} tool(s) matching "${args.query}":` : `Available tools (${tools.length}):`; return { content: [{ type: 'text' as const, text: `${summary}\n\n${toolsList}`, }], }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error searching tools: ${error instanceof Error ? error.message : 'Unknown error'}`, }], isError: true, }; } }, };