Skip to main content
Glama

list_groups

Display all SSH server groups with descriptions and member counts to manage remote server configurations and execute commands across multiple systems.

Instructions

List all server groups with descriptions and member counts.

Returns: Formatted table of groups with name, description, and server count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The list_groups() async function is the main handler for the 'list_groups' tool. It initializes the registry, retrieves all groups using _registry.all_groups(), counts servers per group, and returns formatted output using format_group_table().
    async def list_groups() -> str:
        """List all server groups with descriptions and member counts.
    
        Returns:
            Formatted table of groups with name, description, and server count.
        """
        try:
            _init()
    
            groups = _registry.all_groups()
    
            # Count servers per group
            server_counts = {}
            for group in groups:
                count = len(_registry.servers_in_group(group.name))
                server_counts[group.name] = count
    
            return format_group_table(groups, server_counts)
    
        except Exception as e:
            logger.error(f"Error listing groups: {e}")
            return f"Error listing groups: {e}"
  • The @mcp.tool() decorator registers the list_groups function as an MCP tool with FastMCP server.
    @mcp.tool()
  • The GroupConfig dataclass defines the schema for group data with 'name' and 'description' fields. It's frozen for immutability.
    class GroupConfig:
        """Configuration for a logical server group.
    
        Groups allow organizing servers by environment, function, or team.
    
        Attributes:
            name: Unique group identifier
            description: Human-readable description of the group's purpose
        """
    
        name: str
        description: str
  • The all_groups() method in ServerRegistry retrieves all configured groups from the registry as a list of GroupConfig objects.
    def all_groups(self) -> list[GroupConfig]:
        """Get all configured groups.
    
        Returns:
            List of all GroupConfig objects
        """
        return list(self._groups.values())
  • The format_group_table() function formats a list of groups with their server counts into a human-readable text table for display.
    def format_group_table(groups: list[GroupConfig], server_counts: dict[str, int]) -> str:
        """Format a list of groups into a text table.
    
        Args:
            groups: List of group configurations to display
            server_counts: Mapping of group name to number of servers in that group
    
        Returns:
            Formatted text table with columns: GROUP, SERVERS, DESCRIPTION
    
        Example:
            >>> groups = [GroupConfig(name="prod", description="Production servers")]
            >>> counts = {"prod": 5}
            >>> print(format_group_table(groups, counts))
            GROUP  SERVERS  DESCRIPTION
            prod   5        Production servers
        """
        if not groups:
            return "No groups found."
    
        # Calculate column widths
        max_name = max(len("GROUP"), max(len(g.name) for g in groups))
        max_count = max(
            len("SERVERS"), max(len(str(server_counts.get(g.name, 0))) for g in groups)
        )
    
        # Build header
        lines = [
            f"{'GROUP':<{max_name}}  {'SERVERS':<{max_count}}  DESCRIPTION",
        ]
    
        # Build rows
        for group in groups:
            count = server_counts.get(group.name, 0)
            lines.append(
                f"{group.name:<{max_name}}  {count:<{max_count}}  {group.description}"
            )
    
        return "\n".join(lines)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the return format ('Formatted table') and what columns to expect, which is helpful. However, it doesn't mention important behavioral aspects like whether this requires authentication, has rate limits, returns all groups at once or uses pagination, or if there are any access restrictions. The description adds some value but leaves significant gaps.

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

Conciseness4/5

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

The description is appropriately concise with two clear sentences. The first sentence states the core functionality, and the second describes the return format. There's no wasted text, though the structure could be slightly improved by combining the two sentences more fluidly or adding a brief introductory phrase.

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

Completeness3/5

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

Given the tool has zero parameters, 100% schema coverage, and an output schema exists, the description is reasonably complete for a simple read operation. However, with no annotations and a read operation that likely has behavioral considerations (authentication, data scope, etc.), the description should ideally mention at least basic context about access or limitations. The output schema will handle return structure details, but behavioral transparency remains a gap.

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 zero parameters (schema coverage 100%), so the description doesn't need to explain parameters. The baseline for zero parameters is 4, as there's no parameter documentation burden. The description appropriately focuses on what the tool does rather than parameter details.

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 tool's purpose with a specific verb ('List') and resource ('server groups'), including what information is returned (descriptions and member counts). It distinguishes from sibling 'list_servers' by focusing on groups rather than individual servers. However, it doesn't explicitly differentiate from other potential group-related operations that might exist in the future.

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. While it implicitly suggests this is for viewing group information rather than executing operations (like 'execute_on_group'), there are no explicit when/when-not instructions or references to sibling tools. The agent must infer usage context from the tool name alone.

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

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/blackaxgit/ssh-mcp'

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