Skip to main content
Glama

disconnect

DestructiveIdempotent

Close an active SSH session and release all associated resources, including terminating running commands. Ideal for cleaning up after remote operations.

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

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesSSH session identifier obtained from connect_ssh

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate destructive and idempotent behavior. The description adds detailed transparency by explaining that calling disconnect on an already-closed or unknown id is a safe no-op, that it terminates all running commands, invalidates command_ids, and closes channels and sockets. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections for lifecycle, side effects, when-not-to-use, and returns. It is front-loaded with the main purpose and every sentence adds value. Despite length, it is efficient and not verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity and annotations, the description covers all necessary aspects: lifecycle, side effects, alternatives, idempotency, return value, and parameter semantics. It is fully complete for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers the session_id parameter with a basic description. The description adds substantial meaning: it explains that the id is an opaque UUID from connect_ssh, is used with execute, and is retired by disconnect. It also clarifies that each connect_ssh produces a unique id, and reconnecting the same host yields a new one.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Close an SSH session and release all associated resources.' It distinguishes from sibling tools by explicitly noting it is not needed for local commands and that for stopping a single command, send_control should be used.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use and when-not-to-use guidance. It states that disconnect is for closing SSH sessions, not for local commands, and advises using send_control to stop a single command. It also explains the session lifecycle, making usage context clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/QiuwenZheng/interminal'

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