Skip to main content
Glama
slepp
by slepp

ssh_ensure_session

Return an existing SSH session or start a new one with a stable name, enabling persistent remote execution and state retention across agent tool calls.

Instructions

Return an existing running SSH session or start a new one. This is the recommended tool for agent workflows — always provide a descriptive session_name so the session can be reliably found across tool calls and conversations. When a session is reused (reused=true in response), the cwd, env, and shell parameters are ignored — they only apply when creating a new session. Check 'created' vs 'reused' in the response to know which happened.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRemote directory to cd into (only when creating a new session).
envNoRemote environment variables (only when creating a new session).
portNo
shellNoRemote shell executable (only when creating a new session).
targetYesOpenSSH target such as host, alias, or user@host.
auto_closeNoWhen true, the session is automatically cleaned up after the remote shell or command exits. Only applies when creating a new session. Default: false.
session_nameNoStable name for this session, used for recovery and reuse across tool calls. Choose a short, descriptive kebab-case name reflecting the task, e.g. 'deploy-staging', 'tail-api-logs', 'debug-worker-3'. This name also appears in tmux session listings for human observers. Strongly recommended for any multi-step workflow.
wait_secondsNoSeconds to wait for initial output. Default: 1.0.
identity_fileNo
observer_modeNoObserver mode to ensure on the reused or newly created session. Defaults to 'tmux' and falls back to transcript-only observation if tmux is unavailable.
extra_ssh_argsNoAdditional ssh(1) flags passed verbatim, e.g. ["-J", "jumphost"]. Prefer the dedicated port, identity_file, and strict_host_key_checking parameters.
known_hosts_fileNo
max_output_charsNo
strict_host_key_checkingNoBoolean or one of yes, no, ask, accept-new, off.
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently explains the reuse-ignore semantics and the response status distinction, which are essential for correct usage. It does not mention potential side effects like tmux creation or auth behavior, but the core get-or-create behavior is well disclosed.

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 compact, front-loaded with the primary purpose, and then provides essential usage and behavioral notes in three sentences. Every sentence adds value; there is no fluff or repetition of schema details.

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

Completeness4/5

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

For a tool with 14 parameters and a get-or-create workflow, the description covers the most critical contextual points: session naming for reliability, the reuse behavior, and the response interpretation. It does not enumerate every parameter (schema does that), but it gives the agent enough context to use the tool correctly in a multi-step workflow.

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

Parameters4/5

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

Schema description coverage is 71%, and the description adds crucial semantics beyond the schema: it names the specific parameters (cwd, env, shell) that are ignored on reuse and explains their scope (only apply when creating). This directly compensates for potential ambiguity in the schema and helps the agent reason about parameter relevance per call.

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 opens with a precise verb and resource: 'Return an existing running SSH session or start a new one.' It clearly distinguishes this get-or-create tool from sibling tools like ssh_list_sessions and ssh_start_session by framing its role as the recommended session management entry point for agent workflows.

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 explicitly states when to use it ('recommended tool for agent workflows') and provides actionable guidance: always provide a descriptive session_name. It also clarifies the critical conditional behavior—when a session is reused, cwd/env/shell are ignored—and instructs the agent to check the 'created' vs 'reused' response field to know which case occurred.

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

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