list-all-tools-in-server
Lists all available tools on a specified MCP server by returning their names and descriptions, simplifying tool discovery and management on the MCP Hub.
Instructions
List ALL tools from a specific MCP server (returns name and description only)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serverName | Yes | Name of the MCP server to list tools from |
Implementation Reference
- src/index.ts:212-242 (handler)The tool registration and inline handler function that extracts serverName from args, calls serverManager.listToolsInServer(serverName), and returns the JSON-formatted result or error.server.tool( "list-all-tools-in-server", "List ALL tools from a specific MCP server (returns name and description only)", { serverName: ListToolsInServerParamsSchema.shape.serverName, }, async (args, extra) => { try { const { serverName } = args; const result = await serverManager.listToolsInServer(serverName); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error listing tools from server '${args.serverName}': ${(error as Error).message}`, }, ], }; } } );
- src/types.ts:96-104 (schema)Zod schema defining the input parameter 'serverName' for the list-all-tools-in-server tool.export const ListToolsInServerParamsSchema = z.object({ serverName: z .string() .describe("Name of the MCP server to list tools from"), }); export type ListToolsInServerParams = z.infer< typeof ListToolsInServerParamsSchema >;
- src/server-manager.ts:259-274 (helper)Helper method in McpServerManager that lists tools from the specified server using client.listTools(), filters to name and description only, and returns the result.async listToolsInServer(serverName: string): Promise<any> { const client = this.getClient(serverName); const toolsResponse = await client.listTools(); if (!toolsResponse.tools || !Array.isArray(toolsResponse.tools)) { return { tools: [] }; } // Filter to only include name and description return { tools: toolsResponse.tools.map((tool: any) => ({ name: tool.name, description: tool.description, })) }; }