Skip to main content
Glama

airlock_write_file

DestructiveIdempotent

Writes UTF-8 text to a local file by restoring <ENTITY_N> placeholders from the session vault. Creates parent directories and blocks the write if any placeholder is unknown.

Instructions

Write UTF-8 text to a local file after restoring every <ENTITY_N> placeholder to its original secret.

Purpose & Behavior:
Replaces every `<ENTITY_N>` placeholder in `content` (matching case-insensitively and tolerating inner
whitespace) with its original raw value from the local session vault, creates parent directories if
needed, and overwrites or creates the file at `path`. If `content` contains an unknown or hallucinated
placeholder such as `<API_KEY_999>`, the write is aborted and the target file is left untouched.

When to Use:
- Use after `airlock_read_file` or `airlock_dehydrate` when saving refactored configs, `.env` files, or
  code so real credentials are restored on disk without exposing them to the model.
- Do not invent new `<ENTITY_N>` numbers that were not returned earlier in the session. Call
  `airlock_vault_status` if unsure which tokens exist.

Returns:
A JSON-serializable object with `{"status": "written", "path": str, "restored_tokens": list[str]}` on
success, or `{"status": "error", "error": "unresolved_tokens", "unresolved_tokens": list[str],
"path": str}` when the write is blocked. Raises a tool error for path or workspace guardrail violations.

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": {
      "path": "<path>",
      "content": "<content>"
    },
    "name": "airlock_write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesDestination filesystem path where the rehydrated UTF-8 file will be created or overwritten. Parent directories are created automatically; sensitive system directories (.ssh, .aws, .gnupg, .kube) and out-of-workspace paths are blocked.
contentYesFull UTF-8 file content to write, containing <ENTITY_N> placeholders (e.g., <API_KEY_1>, <AUTH_TOKEN_1>) from the active session vault that will be restored to their original secret values before writing to disk.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.4.6
    • addedInput schema / properties / content / description
      Added value: +"Full UTF-8 file content to write, containing <ENTITY_N> placeholders (e.g., <API_KEY_1>, <AUTH_TOKEN_1>) from the active session vault that will be restored to their original secret values before writing to disk."
    • addedInput schema / properties / path / description
      Added value: +"Destination filesystem path where the rehydrated UTF-8 file will be created or overwritten. Parent directories are created automatically; sensitive system directories (.ssh, .aws, .gnupg, .kube) and out-of-workspace paths are blocked."
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and idempotentHint=true, and the description adds real value on top: parent-directory creation, overwrite semantics, atomic abort on unknown placeholders leaving the file untouched, and guardrails for .ssh/.aws/.gnupg/.kube and out-of-workspace paths. It even specifies error vs. success return shapes. The only mild gap is that 'destructive' overwrite behavior is implied ('overwrites or creates') rather than paired with a warning about existing file contents.

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?

The one-line summary is front-loaded and the Purpose/When to Use/Returns sections are scannable. It is somewhat longer than strictly necessary — the Returns block restates what the abort behavior already conveyed — but no sentence is filler.

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, no-output-schema write tool, the definition covers everything an agent needs: mutation semantics, placeholder resolution rules, failure modes with exact error payloads, and path guardrails. Nothing material is left to inference.

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 still earns a bump by defining placeholder matching rules that the schema does not (case-insensitive, inner whitespace tolerated) and by stating what happens to `content` when an unresolved token is found. `path` semantics are largely duplicated from the schema rather than extended.

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 sentence names a specific verb and resource (write UTF-8 text to a local file) plus the distinctive twist (restoring `<ENTITY_N>` placeholders to secrets). This clearly separates it from `airlock_rehydrate`/`airlock_scrub_text`, which operate on text rather than a file on disk.

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 when-to-use bullets route the agent from `airlock_read_file`/`airlock_dehydrate` output into this write path, and an explicit 'do not' forbids inventing new placeholder numbers. It also names a concrete fallback (`airlock_vault_status`) for the uncertain case, so both the trigger and the exclusion are stated.

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