Skip to main content
Glama

ssh_exec

Run shell commands on remote machines over SSH using existing ~/.ssh/config host aliases, capturing stdout, stderr, and exit codes with configurable timeouts.

Instructions

Run a shell command on a remote machine over SSH. host is an alias from your local ~/.ssh/config (see ssh_hosts). The command runs via a non-interactive remote shell; stdout and stderr are captured, truncated at a configured size limit, and reported together with the exit code. Non-zero exit codes are surfaced, not hidden. Default timeout: 30s (override per call with timeout). For long-running jobs, run them in the background remotely and poll.

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": {
      "host": "<host>",
      "command": "<command>"
    },
    "name": "ssh_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
hostYesSSH config alias of the target host
commandYesCommand to execute on the remote host
timeoutNoTimeout in milliseconds (default: 30000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses non-interactive execution, combined stdout/stderr capture, truncation at a size limit, exit-code surfacing (non-zero codes not hidden), and the 30s default timeout. It omits any warning that arbitrary command execution can mutate or destroy remote state and any auth/permission prerequisites.

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 tight sentences, front-loaded with the core verb and host semantics, then behavior, then the timeout and long-running guidance. No filler.

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 three-param tool with no output schema, the description covers what an agent needs on the return side (stdout+stderr+exit code, truncation) and timeout behavior. The remaining gap is the absence of any destructive-capability or permission caveat for arbitrary shell execution.

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 already 100%, so the baseline is 3, but the description adds real meaning: it explains what a `host` alias resolves to, that the timeout is overridable per call, and reconciles units (30s vs the schema's milliseconds).

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 ('Run a shell command on a remote machine over SSH') and immediately scopes the host parameter to an alias from local ~/.ssh/config. This clearly separates it from siblings like ssh_read_file and ssh_write_file.

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?

Provides clear context for invocation and explicitly routes the agent to `ssh_hosts` for aliases, plus guidance to background long-running jobs rather than block. It stops short of stating when to prefer ssh_read_file/ssh_write_file over a raw shell command, so there is no explicit alternative-selection rule.

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