Skip to main content
Glama
balloonf
by balloonf

ssh_list_sessions

Retrieve a list of all active SSH sessions to monitor and manage connections efficiently using the SSH MCP Server.

Instructions

모든 활성 SSH 세션 목록 조회

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:270-293 (handler)
    The main handler function implementing the ssh_list_sessions MCP tool. It retrieves the list of active sessions from the SSHSessionManager and formats them into a readable string output.
    async def ssh_list_sessions() -> str:
        """모든 활성 SSH 세션 목록 조회"""
        try:
            sessions = await ssh_manager.list_sessions()
            
            if not sessions:
                return "No active SSH sessions"
            
            output = ["Active SSH Sessions:"]
            output.append("-" * 50)
            
            for session_id, info in sessions.items():
                uptime_min = int(info['uptime'] / 60)
                output.append(f"- {session_id}")
                output.append(f"   Host: {info['username']}@{info['host']}:{info['port']}")
                output.append(f"   Status: {'Active' if info['is_active'] else 'Inactive'}")
                output.append(f"   Uptime: {uptime_min} minutes")
                output.append(f"   Commands: {info['command_count']}")
                output.append("")
            
            return "\n".join(output)
            
        except Exception as e:
            return f"Failed to list sessions: {str(e)}"
  • main.py:269-269 (registration)
    Registration of the ssh_list_sessions tool using the @mcp.tool() decorator from FastMCP.
    @mcp.tool()
  • Helper method in SSHSessionManager class that lists all active SSH sessions, handling errors by closing problematic sessions.
    async def list_sessions(self) -> Dict[str, Dict[str, Any]]:
        """모든 세션 목록 조회"""
        
        sessions = {}
        for session_id in list(self.connections.keys()):
            try:
                sessions[session_id] = await self.get_session_info(session_id)
            except Exception as e:
                logger.warning(f"Failed to get info for session {session_id}: {e}")
                # 문제가 있는 세션은 정리
                await self.close_session(session_id)
        
        return sessions
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While '목록 조회' (list/retrieve) implies a read-only operation, it doesn't explicitly state whether this requires special permissions, what data format is returned, whether results are real-time or cached, or if there are rate limits. For a monitoring tool with zero annotation coverage, this is insufficient.

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 Korean sentence that immediately conveys the core functionality. Every word earns its place: '모든' (all) establishes scope, '활성' (active) provides important context, 'SSH 세션' (SSH sessions) identifies the resource, and '목록 조회' (list/retrieve) specifies the action.

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 this is a monitoring tool with no annotations and no output schema, the description should do more to explain what information is returned (session IDs, user names, connection times, etc.) and any behavioral considerations. The current description is too minimal for an agent to understand what to expect from this tool's execution.

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. The description appropriately doesn't discuss parameters since none exist, earning a baseline 4 for not creating confusion about non-existent parameters.

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/retrieve) and resource ('모든 활성 SSH 세션' - all active SSH sessions), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like ssh_session_info (which likely shows details of a specific session), but the 'all active' scope provides some implicit distinction.

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?

The description implies usage context through '모든 활성 SSH 세션' (all active SSH sessions), suggesting this is for monitoring current connections rather than historical data. However, it provides no explicit guidance on when to use this versus alternatives like ssh_session_info (for specific session details) or ssh_close_all_sessions (for termination).

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/balloonf/ssh_mcp'

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