Skip to main content
Glama

ssh_disconnect

Terminate an active SSH connection by specifying its connection ID using this tool. Maintain control over SSH sessions with precision and efficiency.

Instructions

Close an SSH connection

Input Schema

NameRequiredDescriptionDefault
connectionIdYesID of an active SSH connection

Input Schema (JSON Schema)

{ "properties": { "connectionId": { "description": "ID of an active SSH connection", "type": "string" } }, "required": [ "connectionId" ], "type": "object" }

Implementation Reference

  • The core handler function that executes the ssh_disconnect tool: checks for active connection by ID, ends the SSH client connection using conn.end(), removes it from the connections Map, and returns appropriate success or error response.
    private async handleSSHDisconnect(params: any) { const { connectionId } = params; // Check if the connection exists if (!this.connections.has(connectionId)) { return { content: [{ type: "text", text: `No active SSH connection with ID: ${connectionId}` }], isError: true }; } const { conn, config } = this.connections.get(connectionId)!; try { // Close the connection conn.end(); this.connections.delete(connectionId); return { content: [{ type: "text", text: `Disconnected from ${config.username}@${config.host}:${config.port}` }] }; } catch (error: any) { return { content: [{ type: "text", text: `Failed to disconnect: ${error.message}` }], isError: true }; } }
  • src/index.ts:286-287 (registration)
    Registration and dispatch point in the CallToolRequestSchema handler's switch statement that routes ssh_disconnect calls to the handleSSHDisconnect method.
    case 'ssh_disconnect': return this.handleSSHDisconnect(request.params.arguments);
  • Schema definition for ssh_disconnect tool returned by ListToolsRequestSchema handler, specifying input validation requiring 'connectionId' string.
    { name: 'ssh_disconnect', description: 'Close an SSH connection', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'ID of an active SSH connection' } }, required: ['connectionId'] }
  • Initial tool schema registration in server.setTools call, defining input schema for ssh_disconnect.
    ssh_disconnect: { description: "Close an SSH connection", inputSchema: { type: "object", properties: { connectionId: { type: "string", description: "ID of an active SSH connection" } }, required: ["connectionId"] }

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/mixelpixx/SSH-MCP'

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