Skip to main content
Glama

Run a one-off command

terminal_run
Destructive

Run a short command in a fresh non-interactive shell, wait for completion, and return stdout, stderr, exit code, and duration when no persistent session state is needed.

Instructions

Run a command in a fresh non-interactive shell and wait for it to finish. Returns stdout, stderr, exit code and duration. Use this for short commands when no persistent session state is needed.

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

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory. Defaults to the server working directory.
shellNoShell executable. Defaults to $SHELL.
commandYesCommand line to execute.
timeoutMsNoMaximum time to wait in milliseconds. Default 120000 for terminal_exec, 15000 for terminal_write, 30000 for terminal_run.
maxOutputCharsNoCap on captured stdout and stderr characters. Default 200000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare destructive=true, openWorldHint=true, non-idempotent and non-read-only, so the safety profile is covered. The description adds genuinely non-redundant behavior with no output schema present: it blocks until completion and returns stdout, stderr, exit code and duration. The notable omission is what happens when the command exceeds timeoutMs (whether the process is killed or merely abandoned).

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?

Three short sentences with zero filler: what it does and how it blocks first, return shape second, selection guidance last. Every sentence carries information an agent would otherwise have to guess.

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, open-world execution tool, the description supplies the essential pieces: non-interactive execution, blocking semantics, and the return payload. It is slightly thin on failure modes that matter here (timeout behavior, output truncation at maxOutputChars), which are left entirely to the schema.

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%, so all five parameters (command, cwd, shell, timeoutMs, maxOutputChars) are already documented in the schema, including defaults. The description adds no parameter-level meaning beyond that, which is the baseline case for full-coverage schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 command in a fresh non-interactive shell') plus the blocking behavior ('wait for it to finish'). The phrase 'fresh non-interactive shell' and 'no persistent session state' implicitly separates it from the persistent-session siblings (terminal_spawn/terminal_write), but it never names an alternative, so the differentiation stays inferential.

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 a clear positive condition: use for 'short commands when no persistent session state is needed', which is a usable routing rule against the session-based siblings. It offers no explicit exclusion (long-running work, interactive programs, what to do when output is truncated or the timeout fires), so it stops short of full when/when-not guidance.

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