ssh_disconnect
Cleanly close SSH connections by specifying the connection ID. Use this tool to manage and terminate SSH sessions on the Super Windows CLI MCP Server efficiently.
Instructions
Disconnect from an SSH server
Example usage:
{
"connectionId": "raspberry-pi"
}
Use this to cleanly close SSH connections when they're no longer needed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connectionId | Yes | ID of the SSH connection to disconnect |
Implementation Reference
- src/index.ts:543-562 (handler)The main handler for the 'ssh_disconnect' tool. Validates SSH is enabled, parses the connectionId argument, calls SSHConnectionPool.closeConnection, and returns a success message.case "ssh_disconnect": { if (!this.config.ssh.enabled) { throw new McpError( ErrorCode.InvalidRequest, "SSH support is disabled in configuration" ); } const args = z.object({ connectionId: z.string() }).parse(request.params.arguments); await this.sshPool.closeConnection(args.connectionId); return { content: [{ type: "text", text: `Disconnected from ${args.connectionId}` }] }; }
- src/index.ts:252-275 (registration)Registration of the 'ssh_disconnect' tool in the ListTools response, including name, description, and input schema.{ name: "ssh_disconnect", description: `Disconnect from an SSH server Example usage: \`\`\`json { "connectionId": "raspberry-pi" } \`\`\` Use this to cleanly close SSH connections when they're no longer needed.`, inputSchema: { type: "object", properties: { connectionId: { type: "string", description: "ID of the SSH connection to disconnect", enum: Object.keys(this.config.ssh.connections) } }, required: ["connectionId"] } }
- src/index.ts:264-274 (schema)JSON schema definition for the 'ssh_disconnect' tool input, specifying the required connectionId parameter.inputSchema: { type: "object", properties: { connectionId: { type: "string", description: "ID of the SSH connection to disconnect", enum: Object.keys(this.config.ssh.connections) } }, required: ["connectionId"] }
- src/utils/ssh.ts:168-174 (helper)SSHConnectionPool.closeConnection method, which retrieves the connection and calls disconnect() on it, then removes from pool.async closeConnection(connectionId: string): Promise<void> { const connection = this.connections.get(connectionId); if (connection) { connection.disconnect(); this.connections.delete(connectionId); } }
- src/utils/ssh.ts:133-143 (helper)SSHConnection.disconnect method, which clears reconnect timer and calls client.end() to close the SSH connection.disconnect(): void { if (this.reconnectTimer) { clearTimeout(this.reconnectTimer); this.reconnectTimer = null; } if (this.isConnected) { this.client.end(); this.isConnected = false; } }