Search for UTCP Tools
search_toolsFind relevant tools by describing your task. Returns up to 10 matches based on natural language input.
Instructions
Searches for relevant tools based on a task description.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_description | Yes | A natural language description of the task. | |
| limit | No |
Implementation Reference
- index.ts:129-145 (handler)Handler function for 'search_tools' tool. Registers tool via MCP SDK, accepts 'task_description' (string) and 'limit' (number, optional default 10), calls client.searchTools(), returns simplified tool list.
mcp.registerTool("search_tools", { title: "Search for UTCP Tools", description: "Searches for relevant tools based on a task description.", inputSchema: { task_description: z.string().describe("A natural language description of the task."), limit: z.number().optional().default(10), }, }, async (input) => { const client = await initializeUtcpClient(); try { const tools = await client.searchTools(input.task_description, input.limit); const simplified = tools.map(t => ({ name: t.name, description: t.description, input_schema: t.inputs })); return { content: [{ type: "text", text: JSON.stringify({ tools: simplified }) }] }; } catch (e: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: e.message }) }] }; } }); - utcp-client-mcp.ts:106-122 (handler)Handler function for 'search_tools' tool in standalone TypeScript bridge. Same logic as index.ts: registers tool, calls client.searchTools(), returns simplified tool data.
mcp.registerTool("search_tools", { title: "Search for UTCP Tools", description: "Searches for relevant tools based on a task description.", inputSchema: { task_description: z.string().describe("A natural language description of the task."), limit: z.number().optional().default(10), }, }, async (input) => { const client = await initializeUtcpClient(); try { const tools = await client.searchTools(input.task_description, input.limit); const simplified = tools.map(t => ({ name: t.name, description: t.description, input_schema: t.inputs })); return { content: [{ type: "text", text: JSON.stringify({ tools: simplified }) }] }; } catch (e: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: e.message }) }] }; } }); - Handler function for 'search_tools' tool in Python FastMCP bridge. Accepts 'query' (str) and 'limit' (int, default 10), calls self.client.search_tools(), returns list of tool dicts.
@self.mcp.tool(name="search_tools", description="Search for tools. Args: query (str), limit (int, optional)") async def search_tools(query: str, limit: int = 10) -> List[Dict[str, Any]]: tools = self.client.search_tools(query, limit) return [tool.model_dump() for tool in tools] - Handler function for 'search_tools' tool in standalone Python FastMCP bridge. Accepts 'task_description' (str) and 'limit' (int, default 10), calls client.search_tools(), returns dict with tools list.
@mcp.tool() async def search_tools(task_description: str, limit: int = 10) -> Dict[str, Any]: """Search for tools using a query string. Args: task_description: Description of the task to search for tools limit: Optional limit on the number of tools to return Returns: Dictionary with success status and matching tools """ client = await initialize_utcp_client() try: tools = await client.search_tools(task_description, limit) return {"tools": [{"name": tool.name, "description": tool.description, "input_schema": tool.inputs.model_dump(exclude_none=True)} for tool in tools]} except Exception as e: return {"error": str(e)} - index.ts:129-145 (registration)Registration of 'search_tools' via mcp.registerTool() with Zod schema for task_description and limit.
mcp.registerTool("search_tools", { title: "Search for UTCP Tools", description: "Searches for relevant tools based on a task description.", inputSchema: { task_description: z.string().describe("A natural language description of the task."), limit: z.number().optional().default(10), }, }, async (input) => { const client = await initializeUtcpClient(); try { const tools = await client.searchTools(input.task_description, input.limit); const simplified = tools.map(t => ({ name: t.name, description: t.description, input_schema: t.inputs })); return { content: [{ type: "text", text: JSON.stringify({ tools: simplified }) }] }; } catch (e: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: e.message }) }] }; } });