Skip to main content
Glama

disconnect

DestructiveIdempotent

Gracefully disconnect from an active terminal session, terminating background commands and releasing all associated resources to prevent resource leaks.

Instructions

Gracefully disconnects from an active terminal session (SSH or local) and cleans up all associated resources.

BEHAVIOR:
- Terminates any running background commands and subprocesses associated with this session.
- Closes open PTY channels, SSH channels, and network sockets to release system resources.
- Removes the session from the active session manager.

USAGE GUIDELINES:
- ALWAYS call this tool when you are finished executing commands on a session to prevent resource leaks (dangling processes/sockets).
- Do NOT call this tool if you intend to run more commands in this session later.
- ALTERNATIVES:
  * To see all active sessions before disconnecting, use `list_sessions`.
  * To stop a single running command inside the session without closing the entire connection, use `send_control` with "ctrl+c" instead of `disconnect`.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesThe unique session identifier returned by connect_ssh or create_local that you want to close

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond annotations (destructiveHint=true, idempotentHint=true), the description details the specific cleanup actions: terminating background commands/subprocesses, closing PTY channels, SSH channels, network sockets, and removing the session from the session manager. This adds substantial context about the tool's behavior and side effects.

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 a concise main sentence, followed by BEHAVIOR and USAGE GUIDELINES sections. Every sentence is informative and necessary, with no waste. Critical information is front-loaded in the first sentence.

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 has one parameter, annotations, and an output schema, the description is sufficiently complete. It covers the action, cleanup behavior, usage guidelines, and alternatives. No gaps for an AI agent to correctly select and invoke this tool.

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

Parameters3/5

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

Schema coverage is 100% and the schema's parameter description is already clear ('The unique session identifier returned by connect_ssh or create_local that you want to close'). The tool description does not add additional parameter semantics, but since the schema does the job, a baseline 3 is appropriate.

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 tool disconnects from an active terminal session and cleans up resources, specifying both SSH and local sessions. It distinguishes from siblings like send_control (which stops commands without disconnecting) and list_sessions (which only lists sessions). Verb+resource is specific and unambiguous.

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 USAGE GUIDELINES section explicitly states when to call (when finished executing commands), when not to call (if intending to run more commands), and provides clear alternatives: list_sessions for viewing active sessions and send_control with 'ctrl+c' for stopping a single command. This fully addresses when/when-not/alternatives.

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