Skip to main content
Glama

airlock_exec

Destructive

Runs local subprocesses with .env credentials injected and scrubs secrets/PII from stdout and stderr, so tests, migrations, and scripts can use live credentials without leaking sensitive output.

Instructions

Run a local subprocess with .env credentials injected and scrub secrets/PII from its output.

Purpose & Behavior:
Executes `command` directly via `subprocess.run(..., shell=False)` with a 30-second timeout inside the
allowed workspace. If `env_file` is provided, parses `KEY=VALUE` pairs, injects the real unmasked values
into the child process environment, and registers those secrets in the session vault. Before returning,
both `stdout` and `stderr` are scrubbed so printed secrets and stack-trace leaks become `<ENTITY_N>`
placeholders.

When to Use:
- Use this instead of native bash/terminal execution whenever running tests (`pytest`), migrations, or
  scripts that need live `.env` credentials or may print sensitive values.
- Pass commands as a tokenized list of strings (`["pytest", "tests/"]`), never as a single shell string.
- Use `airlock_scrub_text` when you only need to sanitize already-captured output without running anything.

Returns:
A JSON-serializable object with `{"exit_code": int, "stdout": str, "stderr": str}` where both streams have
secrets replaced by `<ENTITY_N>` placeholders. Timeouts and launch failures return `exit_code: -1` with a
scrubbed explanatory `stderr`. Raises a tool error for disallowed executables or invalid commands.

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

Input Schema

NameRequiredDescriptionDefault
commandYesArgv command list to execute without a shell (e.g., ['pytest', '-v'] or ['python', 'scripts/check.py']). The first element is the executable and subsequent elements are literal arguments.
env_fileNoOptional path to a local .env file (KEY=VALUE lines) whose raw secrets are injected into the child process environment at runtime and registered in the session vault so any leaked values in stdout/stderr are scrubbed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.4.6
    • addedInput schema / properties / command / description
      Added value: +"Argv command list to execute without a shell (e.g., ['pytest', '-v'] or ['python', 'scripts/check.py']). The first element is the executable and subsequent elements are literal arguments."
    • addedInput schema / properties / env_file / description
      Added value: +"Optional path to a local .env file (KEY=VALUE lines) whose raw secrets are injected into the child process environment at runtime and registered in the session vault so any leaked values in stdout/stderr are scrubbed."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior3/5

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

The annotations already declare destructiveHint=true, openWorldHint=true, readOnlyHint=false, and non-idempotent, so the risk profile is partly covered. The description still adds real value: a 30-second timeout, shell=False execution, workspace confinement, vault registration of injected secrets, scrubbing of both streams, exit_code -1 on timeout/launch failure, and a tool error for disallowed executables. It does not describe truncation of large output or what happens to previously registered vault entries, which keeps it short of full disclosure given a destructive, open-world tool.

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?

Front-loaded one-line summary followed by clearly headed Purpose/When to Use/Returns sections — easy to scan and nothing is buried. Slight redundancy with the schema's env_file description and a few repeated points about scrubbing keep it from a 5.

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 subprocess tool with no output schema, the description supplies the return object shape, timeout semantics, failure exit codes, and error conditions — everything needed to call it and interpret results. No material gap remains for an agent to act 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, and the description largely restates env_file's injection-and-vault behavior already present in the schema. It does add the 'tokenized list, never a single shell string' warning and ties env_file to the scrubbing outcome, which reinforces rather than duplicates the schema. Marginal added meaning over a fully documented schema earns a 4.

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?

The opening line names a specific verb and resource ('Run a local subprocess') plus the two distinguishing behaviors (env credential injection and output scrubbing). It separates itself cleanly from airlock_scrub_text and from generic terminal tools, so an agent can identify the right tool without inspecting 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?

Explicit routing: use this instead of native bash whenever tests, migrations, or scripts need live .env values or may print secrets, and use airlock_scrub_text when output is already captured. It also states a concrete invocation constraint (tokenized list, never a single shell string), which is the most common way an agent would misuse this tool.

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