Skip to main content
Glama

Write file

write_file
Destructive

Create or overwrite a file with given content. Requires the current rev when overwriting an existing file in revision-policy zones; use edit_file for in-file changes.

Instructions

Create or overwrite a file with given content. In a zone with policy overwrite="rev", overwriting an EXISTING file requires its current rev (creating a new one does not); the refusal message carries the rev to use. For a change inside a file use edit_file. Document formats (PDF, DOCX…) are not overwritten.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
revNoCurrent rev of the file being overwritten. From grep_files, read_text_file offset, or get_file_info.
pathYes
contentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=false, and readOnlyHint=false, so the safety profile is covered. The description adds real beyond-annotation context: the rev-gated overwrite policy, the refusal message carrying the rev to reuse, and that PDF/DOCX are not overwritten. It stops short of describing return format or partial-write behavior, so a 4 is warranted.

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-loads the core action in the first sentence, then adds the rev policy and the edit_file redirect. Three compact sentences with no filler, though the rev-policy clause is dense and could be slightly tighter.

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 destructive mutation tool with no output schema, the description covers the key gotchas: overwrite policy, rev requirement and recovery, sibling routing, and excluded document formats. It leaves the return behavior unspecified, but an agent has enough to call it safely and 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 only 33%, so the description must compensate for rev, path, and content. It explains when rev is required and why (rev policy on overwrite), complementing the schema's note on where to obtain the rev, and the create-vs-overwrite distinction clarifies content semantics. path/content remain self-evident from their names.

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?

States a specific verb pair (create/overwrite) and the resource (file) with the content scope. It also distinguishes itself from siblings by naming edit_file and clarifying that document formats are excluded, so an agent can separate it from read tools and edit_file.

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?

Explicitly routes in-file changes to edit_file and lays out the condition under which rev is required (overwrite='rev' policy on an existing file, not on creation). The refusal-message guidance tells the agent how to recover, which is strong when-to-use/when-not coverage.

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