ssh_cmd_kill
Terminate a running SSH command by its handle ID from ssh_cmd_run. Optionally force-kill a process that doesn't exit after a wait period.
Instructions
Terminate a currently running command by its handle ID (the handle_id field -
also returned as id - from ssh_cmd_run's response).
This tool is specifically for killing commands started with ssh_cmd_run - it
looks up handle_id in this connection's command history, not by raw PID. For
background tasks launched with ssh_task_launch, use ssh_task_kill with the PID
instead. Raises an error if handle_id doesn't exist in history (e.g. from a
previous connection - handles don't survive reconnects) or has no associated PID.
If force=True and the process doesn't exit after wait_seconds, it will be forcibly killed with SIGKILL (signal 9).
Returns:
{'handle_id', 'pid', 'result', 'signal', 'force_kill_used', 'timestamp'}.
result is one of:
- 'not_running': the command was already confirmed not running before any
signal was sent (checked first, via a live PID status check) - nothing to do.
- 'killed': confirmed terminated (by the signal or the force-kill fallback -
see force_kill_used to tell which).
- 'already_exited': the process was gone by the time the signal landed.
- 'failed_to_kill': still running after the signal (and force-kill, if
force=True) - not terminal, the process is still alive.
- 'invalid_pid': the command's tracked PID wasn't a valid positive integer.
- 'error': the kill attempt itself failed unexpectedly - the process's real
state is unknown.
`force_kill_used` is True iff the SIGKILL fallback was actually attempted
(the initial signal alone was not enough), regardless of whether the
fallback itself succeeded - False if the initial signal alone was
sufficient, the process was already gone, or `force=False`.
Note: after a successful kill (`'killed'` or `'already_exited'`, or the early
`'not_running'` case), a later `ssh_cmd_check_status` call for this same
`handle_id` will report status `'killed'`.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force kill with SIGKILL if process doesn't exit | |
| signal | No | Signal to send (15=TERM, 9=KILL) | |
| handle_id | Yes | Command handle ID to kill - the 'id' field from ssh_cmd_run's response | |
| wait_seconds | No | Seconds to wait before force kill |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||