ssh_session_close
Close SSH connections to remote servers by specifying a session ID or terminating all active sessions. This tool helps manage server resources and maintain security by ending unused connections.
Instructions
Close an SSH session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session | Yes | Session ID to close (or "all" to close all sessions) |
Implementation Reference
- src/tool-registry.js:23-28 (registration)Registration of 'ssh_session_close' tool in the 'sessions' group of the centralized tool registry used for conditional tool enablement based on user configuration.sessions: [ 'ssh_session_start', 'ssh_session_send', 'ssh_session_list', 'ssh_session_close' ],
- src/session-manager.js:343-354 (helper)Core helper function that closes an SSH session by ID by calling the session's close method and removing it from the active sessions map. This implements the primary logic for the ssh_session_close tool./** * Close a session */ export function closeSession(sessionId) { const session = sessions.get(sessionId); if (!session) { throw new Error(`Session ${sessionId} not found`); } session.close(); return true;