Skip to main content
Glama
kunwarmahen

SSH Read-Only MCP Server

by kunwarmahen

ssh_list_connections

List all active SSH connections to monitor current remote sessions, enabling oversight of read-only SSH access and audit trails.

Instructions

List all active SSH connections.

Returns: List of active connections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the ssh_list_connections tool. Uses the @mcp.tool() decorator to register it as a FastMCP tool. Iterates over the global ssh_clients dictionary and lists all active connection IDs. Returns 'No active connections' if the dictionary is empty.
    @mcp.tool()
    def ssh_list_connections() -> str:
        """
        List all active SSH connections.
        
        Returns:
            List of active connections
        """
        if not ssh_clients:
            return "No active connections"
        
        connections = []
        for conn_id in ssh_clients.keys():
            connections.append(f"  • {conn_id}")
        
        return "Active SSH Connections:\n" + "\n".join(connections)
  • The handler function for the ssh_list_connections tool in the multicast variant. Uses the @mcp.tool() decorator to register it as a FastMCP tool. Iterates over the global ssh_clients dictionary and lists all active connection IDs.
    @mcp.tool()
    def ssh_list_connections() -> str:
        """
        List all active SSH connections.
        
        Returns:
            List of active connections
        """
        if not ssh_clients:
            return "No active connections"
        
        connections = []
        for conn_id in ssh_clients.keys():
            connections.append(f"  • {conn_id}")
        
        return "Active SSH Connections:\n" + "\n".join(connections)
  • The @mcp.tool() decorator on the handler registers this function as a FastMCP tool named 'ssh_list_connections'.
    @mcp.tool()
    def ssh_list_connections() -> str:
        """
        List all active SSH connections.
        
        Returns:
            List of active connections
        """
        if not ssh_clients:
            return "No active connections"
        
        connections = []
        for conn_id in ssh_clients.keys():
            connections.append(f"  • {conn_id}")
        
        return "Active SSH Connections:\n" + "\n".join(connections)
  • The @mcp.tool() decorator on the handler registers this function as a FastMCP tool named 'ssh_list_connections' in the multicast variant.
    @mcp.tool()
    def ssh_list_connections() -> str:
        """
        List all active SSH connections.
        
        Returns:
            List of active connections
        """
        if not ssh_clients:
            return "No active connections"
        
        connections = []
        for conn_id in ssh_clients.keys():
            connections.append(f"  • {conn_id}")
        
        return "Active SSH Connections:\n" + "\n".join(connections)
  • The global ssh_clients dictionary (line 27) that stores active SSH connections. The tool reads from this dict to list connections.
    ssh_clients = {}
Behavior2/5

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

With no annotations, the description only states 'List all active SSH connections', lacking detail on permissions, side effects, or performance.

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?

Two short, direct sentences with no extraneous information.

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

Completeness4/5

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

For a parameterless tool with an output schema, the description is sufficient but minimal; it could optionally mention output details.

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?

No parameters exist; per guidelines, baseline is 4. Description adds nothing about parameters because there are none.

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

Purpose5/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 the resource 'active SSH connections', distinguishing it from siblings like ssh_connect or ssh_disconnect.

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

Usage Guidelines3/5

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

No explicit guidance on when to use or alternatives, but the simple name and context imply its use for listing active connections.

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

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