disconnect
Close an active SSH session and release all associated resources. Idempotent - safe to call multiple times.
Instructions
Close an SSH session and release all associated resources. NOT needed
for local commands — those clean up automatically.
SESSION_ID LIFECYCLE: The id is an opaque UUID created by connect_ssh,
used with execute, and retired by this call. Each connect_ssh produces
a unique id — reconnecting the same host gives a new one. After
disconnect, execute() with the old id raises ValueError. Calling
disconnect on an already-closed or unknown id is a safe no-op
(idempotent), so cleanup logic never needs to guard against double-close.
SIDE EFFECTS: Terminates all running commands on this session (their
command_ids become invalid), closes SSH channels and TCP socket.
WHEN NOT TO USE: To stop a single command without closing the session,
use send_control with "ctrl+c" instead.
RETURNS: true (always succeeds).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | SSH session identifier obtained from connect_ssh |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |