High Risk →

execute_script

Automate macOS tasks using AppleScript or JXA (JavaScript for Automation) to control applications like Terminal, Chrome, Safari, Finder, etc. **1. Script Source (Choose one):** * `kb_script_id` (string): **Preferred.** Executes a pre-defined script from the knowledge base by its ID. Use `get_s...

High parameter count (11 properties); Single-target operation

Part of the Macos Automator MCP server. Enforce policies on this tool with Intercept, the open-source MCP proxy.

AI agents invoke execute_script to trigger processes or run actions in Macos Automator. Execute operations can have side effects beyond the immediate call -- triggering builds, sending notifications, or starting workflows. Rate limits and argument validation are essential to prevent runaway execution.

execute_script can trigger processes with real-world consequences. An uncontrolled agent might start dozens of builds, send mass notifications, or kick off expensive compute jobs. Intercept enforces rate limits and validates arguments to keep execution within safe bounds.

Execute tools trigger processes. Rate-limit and validate arguments to prevent unintended side effects.

macos-automator.yaml
tools:
  execute_script:
    rules:
      - action: allow
        rate_limit:
          max: 10
          window: 60
        validate:
          required_args: true

See the full Macos Automator policy for all 2 tools.

Tool Name execute_script
Category Execute
Risk Level High

Agents calling execute-class tools like execute_script have been implicated in these attack patterns. Read the full case and prevention policy for each:

Browse the full MCP Attack Database →

Other tools in the Execute risk category across the catalogue. The same policy patterns (rate-limit, validate) apply to each.

execute_script is one of the high-risk operations in Macos Automator. For the full severity-focused view — only the high-risk tools with their recommended policies — see the breakdown for this server, or browse all high-risk tools across every MCP server.

What does the execute_script tool do? +

Automate macOS tasks using AppleScript or JXA (JavaScript for Automation) to control applications like Terminal, Chrome, Safari, Finder, etc. **1. Script Source (Choose one):** * `kb_script_id` (string): **Preferred.** Executes a pre-defined script from the knowledge base by its ID. Use `get_scripting_tips` to find IDs and inputs. Supports placeholder substitution via `input_data` or `arguments`. Ex: `kb_script_id: "safari_get_front_tab_url"`. * `script_content` (string): Executes raw AppleScript/JXA code. Good for simple or dynamic scripts. Ex: `script_content: "tell application \"Finder\" to empty trash"`. * `script_path` (string): Executes a script from an absolute POSIX path on the server. Ex: `/Users/user/myscripts/myscript.applescript`. **2. Script Inputs (Optional):** * `input_data` (JSON object): For `kb_script_id`, provides named inputs (e.g., `--MCP_INPUT:keyName`). Values (string, number, boolean, simple array/object) are auto-converted. Ex: `input_data: { "folder_name": "New Docs" }`. * `arguments` (array of strings): For `script_path` (passes to `on run argv` / `run(argv)`). For `kb_script_id`, used for positional args (e.g., `--MCP_ARG_1`). **3. Execution Options (Optional):** * `language` ('applescript' | 'javascript'): Specify for `script_content`/`script_path` (default: 'applescript'). Inferred for `kb_script_id`. * `timeout_seconds` (integer, optional, default: 60): Sets the maximum time (in seconds) the script is allowed to run. Increase for potentially long-running operations. * `output_format_mode` (enum, optional, default: 'auto'): Controls `osascript` output formatting. * `'auto'`: Smart default - resolves to `'human_readable'` for AppleScript and `'direct'` for JXA. * `'human_readable'`: For AppleScript, uses `-s h` flag. * `'structured_error'`: For AppleScript, uses `-s s` flag (structured errors). * `'structured_output_and_error'`: For AppleScript, uses `-s ss` flag (structured output & errors). * `'direct'`: No special output flags (recommended for JXA). * `include_executed_script_in_output` (boolean, optional, default: false): If `true`, the final script content (after any placeholder substitutions) or script path that was executed will be included in the response. This is useful for debugging and understanding exactly what was run. Defaults to false. * `include_substitution_logs` (boolean, default: false): For `kb_script_id`, includes detailed placeholder substitution logs. * `report_execution_time` (boolean, optional, default: false): If `true`, an additional message with the formatted script execution time will be included in the response. Defaults to false. . It is categorised as a Execute tool in the Macos Automator MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.

How do I enforce a policy on execute_script? +

Add a rule in your Intercept YAML policy under the tools section for execute_script. You can allow, deny, rate-limit, or validate arguments. Then run Intercept as a proxy in front of the Macos Automator MCP server.

What risk level is execute_script? +

execute_script is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.

Can I rate-limit execute_script? +

Yes. Add a rate_limit block to the execute_script rule in your Intercept 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.

How do I block execute_script completely? +

Set action: deny in the Intercept policy for execute_script. 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.

What MCP server provides execute_script? +

execute_script is provided by the Macos Automator MCP server (@steipete/macos-automator-mcp). Intercept sits as a proxy in front of this server to enforce policies before tool calls reach the server.

Enforce policies on Macos Automator

Open source. One binary. Zero dependencies.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.