Skip to main content
Glama

ssh_session_info

Retrieve detailed information about a specific SSH session to monitor connection status, execute commands, and manage remote interactions efficiently using the Model Context Protocol.

Instructions

특정 SSH 세션의 상세 정보 조회

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes

Implementation Reference

  • main.py:316-339 (handler)
    The handler function for the 'ssh_session_info' tool, registered via @mcp.tool() decorator. It fetches session details from the SSHSessionManager and formats them into a readable string output.
    @mcp.tool() async def ssh_session_info(session_id: str) -> str: """특정 SSH 세션의 상세 정보 조회""" try: info = await ssh_manager.get_session_info(session_id) uptime_min = int(info['uptime'] / 60) last_used_min = int((time.time() - info['last_used']) / 60) output = [ f"SSH Session Info: {session_id}", "-" * 40, f"Host: {info['username']}@{info['host']}:{info['port']}", f"Status: {'Active' if info['is_active'] else 'Inactive'}", f"Created: {time.ctime(info['created_at'])}", f"Last Used: {last_used_min} minutes ago", f"Uptime: {uptime_min} minutes", f"Commands Executed: {info['command_count']}" ] return "\n".join(output) except Exception as e: return f"Failed to get session info: {str(e)}"
  • Supporting method in SSHSessionManager class that retrieves the raw session information dictionary, called by the tool handler.
    async def get_session_info(self, session_id: str) -> Dict[str, Any]: """세션 정보 조회""" if session_id not in self.connections: raise Exception(f"Session '{session_id}' not found") metadata = self.session_metadata[session_id] conn = self.connections[session_id] return { 'session_id': session_id, 'host': metadata['host'], 'port': metadata['port'], 'username': metadata['username'], 'created_at': metadata['created_at'], 'last_used': metadata['last_used'], 'command_count': metadata['command_count'], 'is_active': hasattr(conn, '_conn') and conn._conn is not None, 'uptime': time.time() - metadata['created_at'] }
  • main.py:316-316 (registration)
    The @mcp.tool() decorator that registers the ssh_session_info function as an MCP tool.
    @mcp.tool()

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