Skip to main content
Glama
vilasone455

SSH MCP Server

by vilasone455

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
NameRequiredDescriptionDefault
connection_idYes

Implementation Reference

  • 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,
      },
    },
  • 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,
      },
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool terminates a session and removes it from global state, indicating a destructive operation. However, it does not mention potential side effects (e.g., if commands are interrupted), permissions required, or error handling, leaving gaps in behavioral context.

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 a single, efficient sentence that is front-loaded with the core action ('Terminate an SSH session') and includes necessary detail ('remove it from global state'). Every word earns its place, with no redundancy or unnecessary elaboration.

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

Completeness2/5

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

Given the tool's complexity (destructive operation with no annotations and no output schema), the description is incomplete. It lacks details on parameters, return values, error conditions, and behavioral nuances, making it inadequate for safe and effective use by an AI agent without additional context.

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

Parameters2/5

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

The input schema has 0% description coverage, and the tool description does not explain the 'connection_id' parameter at all. It fails to add meaning beyond the schema, such as what a connection_id is, how to obtain it, or format examples, which is insufficient given the low schema coverage.

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 specific action ('Terminate an SSH session') and the resource affected ('remove it from global state'), distinguishing it from siblings like create_connection (creates) and get_connections (reads). It uses precise verbs that convey the tool's exact function without ambiguity.

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

Usage Guidelines3/5

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

The description implies usage when an SSH session needs to be ended and cleaned up, but it does not explicitly state when to use this tool versus alternatives (e.g., when to close vs. keep a connection open) or provide exclusions. The context is clear but lacks explicit guidance on tool selection among siblings.

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/vilasone455/ssh-mcp-server'

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