Run command
run_command
RunCommandTool — execute shell commands with timeout and output truncation.
Registered as run_command via the axm.tools entry point.
RunCommandTool
Execute arbitrary shell commands with timeout and output truncation.
Runs the given command via subprocess.run in the resolved working
directory, with configurable timeout and output size caps. The command
string is executed verbatim by the shell, so this tool can run any
shell command the calling process is permitted to run.
.. warning::
The _BLOCKED_PATTERNS denylist is a best-effort guardrail
against obvious footguns (e.g. rm -rf /), not a security
sandbox. It matches substrings and is bypassable by design
(encoding, indirection, equivalent commands). Do not rely on it for
isolation or to contain untrusted input — treat any command passed
here as executing with the full privileges of the host process.
Registered as run_command via axm.tools entry point.
Source code in packages/axm-edit/src/axm_edit/tools/run_command.py
| Python | |
|---|---|
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
name
property
Tool name used for MCP registration.
execute(*, command=None, path='.', cwd=None, timeout=_DEFAULT_TIMEOUT, **kwargs)
Execute a shell command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str | None
|
Shell command string (required). |
None
|
path
|
str
|
Project root directory (default "."). |
'.'
|
cwd
|
str | None
|
Working directory, relative to root (optional). |
None
|
timeout
|
int
|
Timeout in seconds (default 30). |
_DEFAULT_TIMEOUT
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with stdout, stderr, exit_code, and timed_out. |
Source code in packages/axm-edit/src/axm_edit/tools/run_command.py
render_text(*, stdout, stderr, exit_code, timed_out, truncated)
Render a compact LLM-facing view of a command result.
The header carries the exit code (with a ✗ marker when non-zero so a
failure is impossible to miss) plus explicit timeout / truncated
flags. stdout and stderr are embedded raw (not JSON-escaped),
each under its own labelled section, so no output is ever lost relative to
data — only the structural JSON noise is dropped.