Skip to main content
Glama

Run Command

run_command
Destructive

Executes a shell command and waits for completion, returning exit code, stdout and stderr. Use it to run builds, tests or git commands remotely with optional cwd, env, stdin and timeout.

Instructions

Run a shell command and wait for it to finish. Returns exit code, stdout and stderr. For servers/watchers that never exit, use start_process instead.

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": "run_command"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking folder, relative to the server root. Default = root.
envNoExtra environment variables.
stdinNoText to pipe into the command's stdin.
commandYesShell command to run, e.g. 'npm install', 'pytest -q', 'git status && git diff'.
timeoutNoSeconds before the command (and its children) are killed.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

The annotations already state destructiveHint=true, openWorldHint=true and non-idempotent, so the safety profile is covered by structured data. The description still adds real value by disclosing that the call blocks until termination and that non-terminating processes must be routed elsewhere, though it says nothing about approvals, sandboxing, or what happens to child processes on kill beyond what the timeout param implies.

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?

Two sentences, zero filler, with the primary behavior and return values front-loaded and the alternative routing placed last. Every sentence earns its place.

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?

An output schema exists and the annotations carry the destructive/open-world profile, so the description need not explain return values in detail. It is nearly complete for this complexity; only operational caveats like permission requirements or the meaning of a timeout kill result are left unstated.

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

Parameters3/5

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

Schema description coverage is 100%: cwd, env, stdin, command and timeout each carry their own meaning and defaults in the schema, including that timeout kills children. The description adds no further parameter semantics such as the timeout default or stdin interaction, so the baseline 3 applies.

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 pairs a specific verb and resource ("Run a shell command") with the execution semantics ("wait for it to finish") and the returned fields (exit code, stdout, stderr). This distinguishes it clearly from the sibling start_process, so an agent can select it without opening either schema.

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?

It names the alternative (start_process) and the exact condition that selects it: servers or watchers that never exit. That is an explicit when-not rule plus a routed alternative, which is the strongest form of this guidance.

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