list-all-tools
Discover available tools from connected servers to identify additional capabilities for completing tasks effectively.
Instructions
List all available tools from all connected servers. Before starting any task based on the user's request, always begin by using this tool to get a list of any additional tools that may be available for use.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:26-79 (handler)The asynchronous handler function that implements the logic for the 'list-all-tools' tool. It fetches tools from all connected servers via serverManager and returns a JSON stringified list or error.async (args, extra) => { try { const servers = serverManager.getConnectedServers(); if (servers.length === 0) { return { content: [ { type: "text", text: "No connected servers.", }, ], }; } const allTools: Record<string, any> = {}; // Get tools list from each server for (const serverName of servers) { try { const toolsResponse = await serverManager.listTools(serverName); allTools[serverName] = toolsResponse; } catch (error) { allTools[serverName] = { error: `Failed to get tools list: ${ (error as Error).message }`, }; } } return { content: [ { type: "text", text: JSON.stringify(allTools, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to get tools list from all servers: ${ (error as Error).message }`, }, ], isError: true, }; } }
- src/index.ts:21-80 (registration)The registration of the 'list-all-tools' tool on the MCP server using server.tool(), including name, description, empty schema, and inline handler.// Tool to return tools list from all servers server.tool( "list-all-tools", "List all available tools from all connected servers. Before starting any task based on the user's request, always begin by using this tool to get a list of any additional tools that may be available for use.", {}, // Use empty object when there are no parameters async (args, extra) => { try { const servers = serverManager.getConnectedServers(); if (servers.length === 0) { return { content: [ { type: "text", text: "No connected servers.", }, ], }; } const allTools: Record<string, any> = {}; // Get tools list from each server for (const serverName of servers) { try { const toolsResponse = await serverManager.listTools(serverName); allTools[serverName] = toolsResponse; } catch (error) { allTools[serverName] = { error: `Failed to get tools list: ${ (error as Error).message }`, }; } } return { content: [ { type: "text", text: JSON.stringify(allTools, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to get tools list from all servers: ${ (error as Error).message }`, }, ], isError: true, }; } } );
- src/index.ts:25-25 (schema)Empty schema object indicating no input parameters for the 'list-all-tools' tool.{}, // Use empty object when there are no parameters