Skip to main content
Glama

Run Command

run_command

Execute shell commands and return stdout, stderr, and exit code to inspect system state, debug issues, and validate fixes during authorized security assessments.

Instructions

Run a shell command and return stdout, stderr and exit code.

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 directory (default: server cwd)
envNoextra environment variables to set
sudoNorun via sudo -n (needs passwordless sudo) or sudo -S when LINUXMCP_SUDO_PASSWORD is set on the server
loginNorun as login shell (-lc) so profile/PATH is loaded
shellNoshell to use (default /bin/bash)/bin/bash
commandYesshell command line, e.g. "systemctl status nginx | head"
timeoutNoseconds before the command is killed (default 120)

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden and discloses only the return channels. It says nothing about the risk profile of arbitrary command execution, that the command is killed after timeout, that sudo requires a server-side password or passwordless configuration, or what happens on non-zero exit codes — all of which materially affect how an agent should call it.

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?

A single front-loaded sentence with zero filler, and it correctly puts the action before the return values. It is arguably over-trimmed for a high-risk execution tool, but nothing in it is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/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 not be re-explained, but for a 7-parameter arbitrary-execution tool with no annotations the description is far too thin. Safety expectations, the sibling alternative run_argv, and sudo/timeout behavior are all absent and must be reconstructed from the schema alone.

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 (cwd, env, sudo, login, shell, command, timeout) is already documented in the schema, including the sudo credential nuance. The description adds no parameter meaning beyond that, so the baseline of 3 applies.

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?

The description names a specific verb and resource ("Run a shell command") plus the return surface (stdout, stderr, exit code), so the agent knows exactly what the tool does. It does not, however, distinguish it from the sibling run_argv, which is the obvious near-equivalent and the one case where confusion is likely.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance at all: no statement about preferring run_argv for argument-vector execution, no mention of when sudo/login/shell modes are appropriate, and no prerequisites such as passwordless sudo. The agent must infer all routing decisions from the schema field names.

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

Deploy Server

Other Tools