Skip to main content
Glama

Run a command

run

Executes a single binary with args without a shell, returning structured output with smart truncation for build, test, and lint commands needing exit codes and error details.

Instructions

Run a single command — a binary plus an args array, executed directly without a shell (so no pipes, redirects, or ';'/'&&' in the string) — and return structured output with smart truncation. Pass the binary as command and its arguments as args (e.g. command='npm', args=['test']); for a real shell pipeline run the shell yourself: command='sh', args=['-c', 'a | b > c']. Keeps the last N lines of output by default (where errors typically appear), or the first N with mode='head'. Use for build, test, and lint commands where you need exit code and error details, not full verbose output.

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory
argsNoArguments passed directly to the binary (e.g. ['test']). With command='sh', use ['-c', '<shell script>'].
modeNoKeep the last N lines (tail, default) or the first N (head).tail
commandYesThe binary to execute — NOT a shell string (e.g. 'npm', 'git', 'sh'). For pipes/redirects, use command='sh' and put the script in args.
timeoutNoTimeout in ms
collapseNoMerge consecutive repeated lines (timestamps ignored) into the first, marked ' [×N]' (default true). false = output verbatim.
maxBytesNoOptional cap on stdout/stderr byte length (UTF-8).
maxLinesNoMax stdout/stderr lines to keep. 0 = unlimited.

Output Schema

NameRequiredDescriptionDefault
stderrYes
stdoutYes
elapsedYesWall-clock execution time in milliseconds
exitCodeYes
retainedNo
truncatedYes
stdoutLinesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.0.1

TDQS

A4.1/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 disclose the execution model (no shell, so no pipes/redirects/';'), opposite defaults ('Keeps the last N lines ... where errors typically appear') and the head-mode override. It omits the safety profile an arbitrary-command executor needs: no mention that it runs with the agent's user permissions, can mutate the filesystem, or what happens to output/process on timeout.

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?

Front-loaded with the execution model and truncation behavior, and every clause serves usage (examples, shell workaround, mode). The single dense run-on with em-dashes and parentheticals is harder to scan than a short bulleted structure, but there is 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?

An output schema exists, so return values need no explanation; the description covers the exec model, argument passing, truncation defaults and mode switching. Remaining gaps are timeout semantics (process killed? partial output?) and permission/side-effect disclosure for an arbitrary binary executor with 8 parameters.

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 every parameter including cwd, timeout, collapse, maxBytes and maxLines is already documented. The description reinforces command/args with examples (command='npm', args=['test']) and restates the tail/head behavior, but adds little semantic detail beyond the schema — baseline 3.

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 concrete verb and resource ('Run a single command — a binary plus an args array') and pins the execution model ('executed directly without a shell'), which cleanly separates it from run_seq and batch. An agent knows exactly what this does before 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 positive guidance ('Use for build, test, and lint commands where you need exit code and error details, not full verbose output') and an explicit escape hatch for shell pipelines via command='sh', args=['-c', ...]. It never names the more specific siblings (npm_test, npm_lint, python_test) that an agent should arguably prefer, so routing between alternatives is still partly inferred.

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