Skip to main content
Glama

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
NameRequiredDescriptionDefault
serverNameYesName of the MCP server to list tools from

Implementation Reference

  • 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}`,
              },
            ],
          };
        }
      }
    );
  • 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
    >;
  • 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,
        }))
      };
    }
Install Server

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/warpdev/mcp-hub-mcp'

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