Skip to main content
Glama

connect_ssh

Establish a persistent SSH connection, returning a session ID for subsequent command execution via execute. Supports key-based and password authentication with auto-acceptance of host keys.

Instructions

Opens a persistent SSH connection and returns a session_id for use with
`execute`. The connection stays open until `disconnect`. Host keys are
auto-accepted. For local commands, call `execute` directly — no session needed.

PARAMETER GUIDANCE: Reuse session_id across multiple execute calls —
each connect_ssh opens a new TCP connection. key_filepath is tried
first when both key and password are provided; password acts as
fallback. With neither, SSH agent and system defaults are used. The
username defaults to the OS user if omitted. host is resolved at
connect time; unresolvable names raise an error. banner_timeout
controls MOTD capture — if exceeded, banner returns "" (not an error);
set to 0 to skip capture entirely.

SIDE EFFECTS: Opens a TCP socket with a 30-second keepalive. Leaks
the socket if `disconnect` is never called.

ERRORS: Raises on auth failure, unresolvable host, refused connection,
or network timeout.

RETURNS: {"session_id": str, "banner": str}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesHostname or IP of the SSH server (e.g. '192.168.1.10', 'example.com')
portNoSSH port number, 1–65535
passwordNoPassword for password-based auth; omit for key-based auth
usernameNoLogin user for authentication; omit to use SSH agent or OS default
key_filepathNoAbsolute path to a private key file (e.g. '/home/user/.ssh/id_rsa')
banner_timeoutNoMax seconds to capture the MOTD/welcome banner after login
Behavior5/5

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

Discloses side effects (TCP socket with keepalive, leak if disconnect not called), errors (auth, unresolvable host, etc.), and behaviors like host resolution and banner capture. Adds context beyond 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?

Well-structured with sections: overview, parameter guidance, side effects, errors, returns. Front-loaded purpose. No wasted words; each sentence adds value.

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?

Complete for a complex tool: covers all 6 parameters, side effects, error conditions, and return format. No gaps in information needed for correct invocation.

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?

Schema coverage is 100%, but the description adds valuable guidance: key_filepath tried first, password fallback, username defaults, banner_timeout behavior (0 skips). Adds meaning beyond schema.

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 it opens a persistent SSH connection and returns a session_id for use with 'execute'. It distinguishes from sibling tools like 'execute' (for local commands) and 'disconnect'.

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?

Explicit guidance: 'For local commands, call execute directly — no session needed.' Details parameter precedence, default behavior, banner timeout, and the lifecycle (connect, execute, disconnect).

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