Skip to main content
Glama

Run Shell Command

shell_exec
Destructive

Runs arbitrary shell commands on the Unraid host over SSH as the SSH user, requiring explicit confirmation before execution.

Instructions

⚠ Runs an arbitrary shell command on the Unraid host over SSH as the SSH user (typically root, i.e. full control of the server). Requires confirm: true on every call; without it the tool refuses and nothing runs. Prefer a dedicated tool when one covers the task, and use file_read for plain file reads (it is ungated). Non-zero exit codes are reported as results, not errors; stdout and stderr are each truncated beyond 30000 characters. Requires SSH to be configured (UNRAID_SSH_* environment variables).

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

Input Schema

NameRequiredDescriptionDefault
commandYesCommand line run by the host's shell as the SSH user; pipes work, e.g. `dmesg | tail -n 50`.
confirmNoSet `true` only after the user approves this specific change; otherwise the tool refuses or prompts them.
response_formatNo`detailed` returns full JSON instead of readable text.concise
timeout_secondsNoSeconds to wait for the command; on timeout the call fails but the remote process may keep running.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.1.3
    • addedInput schema / properties / command / description
      Added value: +"Command line run by the host's shell as the SSH user; pipes work, e.g. `dmesg | tail -n 50`."
    • addedInput schema / properties / confirm / description
      Added value: +"Set `true` only after the user approves this specific change; otherwise the tool refuses or prompts them."
    • addedInput schema / properties / response_format / description
      Added value: +"`detailed` returns full JSON instead of readable text."
    • addedInput schema / properties / timeout_seconds / description
      Added value: +"Seconds to wait for the command; on timeout the call fails but the remote process may keep running."
  2. First observedv0.1.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare destructive, open-world, non-idempotent, and non-read-only behavior, but the description adds material context: the confirm gate and refusal behavior, non-zero exit codes surfaced as results rather than errors, stdout/stderr truncation at 30000 characters, and the UNRAID_SSH_* prerequisite. It does not restate the annotation hints, so the additions are genuinely complementary.

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?

The warning and the highest-risk facts (root-level arbitrary execution, confirm gate) are front-loaded, and each sentence carries distinct information. It is dense with parentheticals and environment-variable detail, which slightly taxes readability, but nothing is redundant.

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?

For a destructive, open-world execution tool with no output schema, the description covers the safety gate, prerequisite configuration, result semantics (exit codes, truncation), and routing to safer alternatives. An agent has everything needed to decide and call correctly.

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 the baseline is 3, but the description adds meaning the schema does not fully convey: `confirm` is required on every call and omission causes refusal, which is stronger than the schema's softer wording. It does not elaborate on response_format or timeout beyond what the schema already documents.

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 an arbitrary shell command on the Unraid host over SSH) and immediately names the execution context and privilege level (SSH user, typically root). This is unmistakably distinct from siblings like file_read or array_action.

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?

Explicitly says to prefer a dedicated tool when one covers the task and names file_read as the ungated alternative for plain file reads. It also states the mandatory `confirm: true` precondition, giving both when-to-use and when-to-prefer-otherwise guidance.

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