Skip to main content
Glama
axross-headless-mcp

axross-headless-mcp

Run backend script

run_backend_script
Destructive

Runs multi-line scripts (bash, Python, Perl, PowerShell) on a remote backend host to handle looped or multi-step tasks, returning exit code, stdout, and stderr.

Instructions

Run a multi-line script on a remote host: sh, bash, python3 or perl on POSIX, PowerShell on WinRM. Use when: the job needs loops or a scripting language there. Instead: run_backend_command for one command; run_script on this machine. Requires: --mcp-tools exec and --mcp-allow-exec; not in paranoid mode; a backend that list_backends gives commands (not null). Behavior: destructive - runs with the profile user's rights. The script goes to the interpreter's stdin, so it cannot read stdin itself. Refused on production profiles and Cisco. Time limit: timeout; past it the call fails and no output returns. Returns: {returncode, stdout, stderr, truncated_stdout, truncated_stderr} (text, UTF-8 with undecodable bytes replaced).

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": {
      "script": "<script>",
      "backend": "<backend>"
    },
    "name": "run_backend_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNoEnvironment variables for the script as {NAME: value}, e.g. {"LANG": "C"}. On POSIX shells they are exported in the command line, so other users of the host may see the values: pass no secrets this way.
argsNoArguments passed to the script ($1... / sys.argv[1:]) as raw strings; the server shell-quotes each one. POSIX hosts only. Default: none.
scriptYesThe script text, e.g. 'for f in /var/log/*.log; do wc -l "$f"; done'.
backendYesBackend id from list_backends (can_run_commands=true), e.g. 'profile:web1'.
timeoutNoSeconds the script may run (at most 1740, below the call's 30 min); longer fails with a timeout error and returns no output.
max_outputNoMost bytes of stdout kept; stderr keeps min(max_output, 1 MiB). truncated_stdout / truncated_stderr tell when output was cut.
interpreterNoWhat runs the script. powershell: WinRM only (its default); bash, perl, python3, sh (the POSIX default): POSIX only; a mismatch fails.

Output Schema

NameRequiredDescriptionDefault
stderrYes
stdoutYes
returncodeYes
truncated_stderrYes
truncated_stdoutYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.15.181

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only declare the safety profile; the description adds substantive behavior beyond that: runs with the profile user's rights, the script is fed to the interpreter's stdin so it cannot itself read stdin, calls are refused on production profiles and Cisco, and a timeout produces a failure with no output. It also enumerates the return fields and their encoding, so the agent knows the shape of both success and failure.

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?

Dense but front-loaded and labeled (Use when / Instead / Requires / Behavior / Returns), so an agent can scan for the part it needs. The one redundancy, restating the timeout behavior already in the schema, is minor and arguably reinforces the no-output-on-timeout consequence.

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 7-parameter destructive remote-execution tool, the definition covers permissions, profile restrictions, interpreter/transport mismatch, stdin limitation, timeout outcome, and result shape. Even though an output schema exists, the return summary is a helpful pointer rather than filler, and nothing an agent needs to call this safely appears missing.

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; the description earns more by noting the stdin constraint that governs how `script` may be written, and by restating the timeout consequence. The env/args/interpreter parameters are left to their (already thorough) schema descriptions rather than elaborated further.

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?

Names a specific verb and resource ('Run a multi-line script on a remote host') and immediately scopes it by interpreter/transport (sh, bash, python3, perl on POSIX; PowerShell on WinRM). The distinction from run_backend_command ('one command') and run_script ('this machine') makes it separable from siblings without 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 Guidelines5/5

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

Has explicit 'Use when: the job needs loops or a scripting language there' plus an 'Instead:' line that routes to run_backend_command and run_script. It also states preconditions (--mcp-tools exec, --mcp-allow-exec, not paranoid mode, backend must list commands) and exclusions (production profiles, Cisco), which is unusually complete routing information.

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