run_terminal_command
Runs a shell command on the user's Mac and returns its output. OFF by default — the user must turn it on in the LMCP menu-bar app (it stays off until they opt in). Also disabled when LMCP is in read-only mode. Dangerous commands (sudo, recursive deletes of system/home paths, disk formatting, shut...
This record as markdown: /tools/com-local-mcp-local-mcp/run-terminal-command.md
What run_terminal_command does on Local
AI agents invoke run_terminal_command to trigger actions in Local. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | The shell command to run (a single command line, executed with /bin/zsh -lc). |
confirm | boolean | — | Must be true to actually run. Without it, a preview of the command is returned. |
working_dir | string | — | Optional absolute working directory. Defaults to the user's home directory. |
timeout_seconds | integer | — | Max seconds to run before it is terminated (default 20, max 60). |
Parameters from the server's own tool schema.
Why run_terminal_command is rated High
While the tool has safeguards (user opt-in, read-only mode disabling, dangerous command blocking, preview-before-execute flow), it remains fundamentally an Execute category tool because it runs arbitrary shell commands whose effects depend on the arguments provided. It is not Destructive because the dangerous destructive operations are explicitly refused.
From the tool's definition Tool description states it 'Runs a shell command on the user's Mac and returns its output' and explicitly blocks 'Dangerous commands (sudo, recursive deletes of system/home paths, disk formatting, shutdown/reboot, piping a downloaded script into a shell, fork…
Attacks that exploit this kind of access
The rule that runs run_terminal_command safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Local, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For run_terminal_command, this is the rule to start with:
run_terminal_command stays usable, but rate-capped: a runaway agent can't fire it dozens of times a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Local, apply this rule, and every run_terminal_command call is checked against it from then on.
Questions about run_terminal_command
Runs a shell command on the user's Mac and returns its output. OFF by default — the user must turn it on in the LMCP menu-bar app (it stays off until they opt in). Also disabled when LMCP is in read-only mode. Dangerous commands (sudo, recursive deletes of system/home paths, disk formatting, shutdown/reboot, piping a downloaded script into a shell, fork bombs, daemon control) are refused. Destructive: it previews the command first — pass confirm:true to actually run it. Output and runtime are capped. It is categorised as a Execute tool in the Local MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.
run_terminal_command accepts 4 parameters: command, confirm, working_dir, timeout_seconds. Required: command. The full parameter table on this page comes from the server's own tool schema.
Register the Local MCP server in PolicyLayer and add a rule for run_terminal_command: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Local. Nothing to install.
run_terminal_command is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.
Yes. Add a rate_limit block to the run_terminal_command rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for run_terminal_command. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
run_terminal_command is provided by the Local MCP server (local-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Local, and thousands of servers like it.
Across the catalogue