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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- ssh_readonly_fastmcp.py:182-197 (handler)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) - ssh_readonly_fastmcp_mcast.py:296-311 (handler)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) - ssh_readonly_fastmcp.py:182-197 (registration)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) - ssh_readonly_fastmcp_mcast.py:296-311 (registration)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) - ssh_readonly_fastmcp.py:27-27 (helper)The global ssh_clients dictionary (line 27) that stores active SSH connections. The tool reads from this dict to list connections.
ssh_clients = {}