Skip to main content
Glama

fs_write_file

DestructiveIdempotent

Atomically writes UTF-8 files inside the workspace root, using temp-file swap, optional SHA-256 concurrency checks, and idempotency keys to prevent unsafe overwrites or duplicate retries.

Instructions

Atomically write a UTF-8 text file inside the workspace root using O_NOFOLLOW temp-file swap, optional Optimistic Concurrency Control (expected_sha256), and idempotency_key.

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

Input Schema

NameRequiredDescriptionDefault
pathYesRelative file path inside the workspace root.
contentYesFull UTF-8 text content to write atomically.
expected_sha256NoOptional SHA-256 hex digest of the existing file for Optimistic Concurrency Control (CAS).
idempotency_keyNoOptional unique key to guarantee idempotent replay protection on retries.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=true, and a closed world, so the safety bar is partially covered. The description adds genuinely new behavioral facts beyond that: atomic temp-file swap, O_NOFOLLOW symlink protection, workspace-root confinement, and CAS-based conflict detection on writes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with the action, scope, and guarantees in order of importance, with no filler or redundant restatement of the name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter mutating tool with full schema coverage and no output schema, the description covers safety, atomicity, and concurrency adequately. It omits the observable outcome of a failed CAS check or what the call returns, which would have made it complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description only restates that expected_sha256 implements optimistic concurrency control and idempotency_key protects retries, which the schema fields already say; it adds no format or failure-mode detail (e.g., what happens on digest mismatch).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('Atomically write a UTF-8 text file inside the workspace root') and names the mechanism, so the agent knows this is a full-content write rather than a diff/append. It does not explicitly name fs_patch_file as the alternative, so it stops short of full sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: the mention of expected_sha256 (OCC) and idempotency_key signals when to supply those options, and 'write a file' implies whole-content replacement. There is no explicit statement of when to prefer this over fs_patch_file or when not to use it.

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