close_connection
Terminate SSH sessions to securely end remote connections and release system resources when remote work is complete.
Instructions
Terminate an SSH session and remove it from global state.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes |
Implementation Reference
- src/index.ts:444-460 (handler)Handler implementation for the 'close_connection' tool. It retrieves the SSH connection by ID from the global connections Map, ends the client connection, removes it from the Map, and returns a success response.if (name === "close_connection") { const { connection_id } = args as { connection_id: string }; const conn = connections.get(connection_id); if (!conn) throw new Error(`connection_id '${connection_id}' not found.`); conn.client.end(); connections.delete(connection_id); return { content: [ { type: "text", text: JSON.stringify({ closed: true }, null, 2), }, ], }; }
- src/index.ts:196-205 (registration)Registration of the 'close_connection' tool in the ListTools response, including its name, description, and input schema.{ name: "close_connection", description: "Terminate an SSH session and remove it from global state.", inputSchema: { type: "object", required: ["connection_id"], properties: { connection_id: { type: "string" } }, additionalProperties: false, }, },
- src/index.ts:199-205 (schema)Input schema definition for the 'close_connection' tool, specifying the required 'connection_id' parameter.inputSchema: { type: "object", required: ["connection_id"], properties: { connection_id: { type: "string" } }, additionalProperties: false, }, },