Skip to main content
Glama

list-servers

Display all active MCP servers connected to the central hub server for easy monitoring and management of distributed resources.

Instructions

List all connected MCP servers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the "list-servers" tool. It calls serverManager.listServers() to get the list of connected servers and returns it formatted as JSON text content in the MCP response format.
    async (args, extra) => {
      try {
        const servers = serverManager.listServers();
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({ servers }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error listing servers: ${(error as Error).message}`,
            },
          ],
        };
      }
    }
  • src/index.ts:286-313 (registration)
    Registration of the "list-servers" tool using the MCP server's tool() method, with an empty schema (no parameters) and an inline handler function.
    server.tool(
      "list-servers",
      "List all connected MCP servers",
      {}, // No parameters needed
      async (args, extra) => {
        try {
          const servers = serverManager.listServers();
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({ servers }, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error listing servers: ${(error as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Helper method listServers() in McpServerManager class, which delegates to getConnectedServers() to retrieve the list of connected server names.
    listServers(): string[] {
      return this.getConnectedServers();
    }
  • Supporting helper method getConnectedServers() that extracts the names of connected servers from the internal Map of clients.
    getConnectedServers(): string[] {
      return Array.from(this.clients.keys());
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does but reveals nothing about how it behaves: no information about permissions required, rate limits, pagination, error conditions, or what 'connected' means (e.g., active vs. configured servers). For a tool with zero annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without any fluff. It's appropriately sized for a simple listing tool and front-loads the essential information. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what 'connected' means operationally, what the return format looks like (e.g., list of server names, IDs, statuses), or any behavioral constraints. For a tool with no structured metadata, the description should provide more context about outputs and usage conditions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the parameter situation (none). The description doesn't need to add parameter information, and it doesn't attempt to. Baseline for 0 parameters is 4, as there's no parameter semantics burden to address.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all connected MCP servers'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list-all-tools' or 'list-all-tools-in-server', which also list resources but focus on tools rather than servers. A perfect score would require explicit sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'list-all-tools' and 'list-all-tools-in-server' available, there's no indication whether this tool should be used for server discovery, tool discovery, or other contexts. No explicit when/when-not statements or alternative recommendations are present.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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