Skip to main content
Glama

ssh_exec

Execute a command on a connected SSH session and return stdout, stderr, and exit code; use timeouts or background jobs for long-running tasks.

Instructions

Execute a command on a connected SSH session. Returns stdout, stderr, and exit code. timeout applies to this call only; on timeout the execution channel is closed and the command is not run again. Set background=true to return a job_id immediately, then use ssh_exec_poll and ssh_exec_cancel. If session_id is omitted, uses the default pre-configured session.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "command": "<command>"
    },
    "name": "ssh_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandYesCommand to execute on the remote server
timeoutNoOverride command timeout in ms. For background jobs this is optional; omit it to keep the command running until it exits or is cancelled.
backgroundNoReturn immediately and keep the command running as a job
session_idNoSession ID (optional if using pre-configured server)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden well: it discloses the timeout scope and the important consequence that on timeout the channel is closed and the command is NOT retried, plus the background job handoff. It stops short of warning about arbitrary-command side effects or the maximum 300000ms bound, so not fully exhaustive.

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?

Four short sentences, front-loaded with the action and return values, then the timeout caveat, then the background workflow. No sentence is redundant or restates the name.

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?

Although there is no output schema, the description names the returned fields, explains the timeout failure mode, and fully describes the asynchronous job pattern with sibling tools. Nothing an agent needs to invoke this correctly is missing.

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 coverage is 100%, so the baseline is 3; the description still adds value by clarifying that timeout applies to this call only and that background jobs may omit it to run until exit or cancellation, and that session_id falls back to a default. These are semantic clarifications beyond the field text.

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?

States a specific verb and resource ('Execute a command on a connected SSH session') plus the return payload (stdout, stderr, exit code). It also distinguishes itself from close siblings by naming ssh_exec_poll and ssh_exec_cancel in the background flow, so an agent can route without opening other schemas.

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

Usage Guidelines4/5

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

Gives clear conditional guidance: set background=true to get a job_id, then use ssh_exec_poll / ssh_exec_cancel; omit session_id to use the default pre-configured session. It does not say when to prefer this tool over sftp_* siblings for file operations, which is the main remaining gap.

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