Skip to main content
Glama
SSH MCP Server
by termau

run_command

Destructive

Executes a shell command on a remote server over SSH and returns stdout, stderr, and exit code.

Instructions

Execute a command on a remote server via SSH.

Runs a shell command and returns stdout, stderr, and exit code.

Parameters:

  • connection: Name of the connection (from list_connections)

  • command: The shell command to execute

  • timeout: Command timeout in milliseconds (default: 30000)

Example usage: run_command("web1", "uptime") Example usage: run_command("db1", "systemctl status mysql", 60000)

Returns:

  • stdout: Command standard output

  • stderr: Command standard error

  • code: Exit code (0 = success)

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": {
      "connection": "<connection>",
      "command": "<command>"
    },
    "name": "run_command"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandYesShell command to execute
timeoutNoTimeout in milliseconds (default: 30000)
connectionYesName of the SSH connection to use

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=true, so the safety profile is known and the description's job is lighter. It adds the default timeout value and the exact return fields, but says nothing about execution context — whose privileges the command runs under, output size limits, or that side effects are unbounded because any shell command may be issued.

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 purpose is front-loaded in the opening line, followed by compact parameter, example, and return sections. The slight overlap between the opening line and the Returns block is defensible given there is no output schema.

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 destructive, three-parameter tool with no output schema, the definition covers purpose, parameter meanings, worked examples, and return shape. The remaining gap is operational context — privilege level, output truncation, or behavior on timeout — which an agent would want before issuing risky commands.

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, and the description earns above that by adding concrete example invocations that show positional order and realistic values ('web1', 'uptime'; 60000 for a slow command). It also explicitly links the connection parameter to the list_connections tool, which the schema does not.

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 first sentence gives a specific verb and resource ('Execute a command on a remote server via SSH') and the second states the return payload (stdout, stderr, exit code). This is clearly distinguishable from siblings such as read_remote_file, download_file, or list_remote_directory, which are scoped to a single file or directory operation.

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?

Usage is implied rather than stated: the examples show general command execution and the parameter notes point to list_connections for obtaining a connection name, which is useful setup context. However, there is no guidance on when to prefer this over narrower siblings like read_remote_file or download_file, and no exclusions or warnings about arbitrary command scope.

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