Skip to main content
Glama

run_command

Execute a shell command on a remote server over SSH in an already-open session, with access-policy checks and automatic secret masking on the returned output.

Instructions

Runs one shell command on a remote server over SSH, through an already-open session (see open_session). The command is checked against this host's access policy before it runs: it may execute immediately, be denied outright (POLICY_DENIED), be rejected because it needs a terminal (INTERACTIVE_COMMAND — the error message gives you a batch-mode command to retry with instead), or pause while the user is asked to approve it. cd and environment persist across calls on the same session; the response always reports the resulting working directory. stdout/stderr are scanned and secrets are masked as [REDACTED:type] before being returned. A command still running when the timeout runs out comes back with timedOut: true. Output that is not valid UTF-8 comes back lossy with binary: true; pipe it through base64 or xxd to read the bytes. Pass a one-line description of what the command does and why: the user sees it when asked to approve.

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

Input Schema

NameRequiredDescriptionDefault
commandYesThe full shell command to run, exactly as it should be typed at a prompt. Runs in the session's current working directory; use `cd` within the command to change it.
sessionIdYesThe sessionId returned by open_session.
descriptionNoOne short sentence for the user: what this does and why. Shown in the approval window next to the exact command, which is what the user judges; it does not change what is allowed. Recommended for chained or long commands.
timeoutSecondsNoHow long to wait for the command before attempting recovery (Ctrl-C, then reopening the shell if that does not work). Defaults to the timeout set in ShellVibe's settings (60 unless changed); clamped to a maximum of 600.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so thoroughly: it enumerates the four policy outcomes (immediate run, POLICY_DENIED, INTERACTIVE_COMMAND, user approval pause), notes that cd and environment persist across calls, that secrets are masked as [REDACTED:type], and that timeouts surface as timedOut and non-UTF-8 output as binary. This is exactly the behavioral context an agent needs before issuing a command.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and prerequisite are front-loaded, and nearly every sentence adds a distinct operational fact. The single dense paragraph packs multiple error codes and output flags together, which makes it slightly heavy to scan, but there is little filler.

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?

There is no output schema, yet the description documents the meaningful return characteristics (resulting working directory, timedOut, binary, redaction) and the policy/approval lifecycle. For a command-execution tool of this complexity, an agent has everything needed to call it and interpret the result.

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 baseline is 3, but the description adds real meaning: it explains that cd inside a command changes the persistent working directory, that timeout expiry triggers Ctrl-C and shell reopening with a timedOut flag, and that the description parameter is what the user sees in the approval window. It reinforces rather than merely restates the 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?

States a specific verb and resource ('Runs one shell command on a remote server over SSH') plus the prerequisite ('through an already-open session (see open_session)'), which cleanly separates it from run_snippet, run_runbook, and upload_file. An agent knows exactly what this does without opening the schema.

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 preconditions (session must already be open via open_session) and recovery guidance for the INTERACTIVE_COMMAND rejection, telling the agent to retry in batch mode. It stops short of explicitly naming when to prefer a sibling such as run_snippet or run_runbook over an ad-hoc command, so it is strong but not fully exclusionary.

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