Skip to main content
Glama

Write file

write_file
Destructive

Use this when the user asks to create or replace the complete contents of exactly one text file. For a small exact-block edit use edit_block, for a known line range use replace_lines, and when you already have a unified diff use apply_patch. For two or more independent complete files use write_files; use write_binary for binary bytes.

Input Schema

NameRequiredDescriptionDefault
modeNorewrite replaces the file content, append adds to the end. Default rewrite.
pathYesAbsolute path of the file to write.
deviceYesReMCP device id returned by list_devices. Required for every device operation.
contentYesFull file content, or the text to append.

Output Schema

NameRequiredDescriptionDefault
dataNoOptional structured result data for follow-up reasoning and tool calls.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, so the description doesn't need to restate that. It adds useful context by clarifying the 'rewrite' vs 'append' modes and the 'exactly one file' scope. It doesn't mention side effects like overwriting existing content, but the destructiveHint annotation covers that, and the description's mode explanation is sufficient.

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?

The description is a single, dense sentence that front-loads the primary use case and then lists alternatives. Every clause earns its place, and there is no filler or repetition of the title.

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 write tool with destructiveHint=true and a complete schema, the description covers the main decision points: when to use it, what it does, and which siblings to use instead. It doesn't mention return values, but the output schema exists, so that's not required. The only minor gap is not explicitly warning about data loss, but the destructiveHint annotation covers that.

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 schema already documents all four parameters. The description adds the 'exactly one file' constraint and the mode distinction, but doesn't add much beyond the schema. Baseline 3 is appropriate when the schema carries the parameter documentation.

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 description states a specific verb ('create or replace'), a precise resource ('complete contents of exactly one text file'), and explicitly distinguishes itself from sibling tools (edit_block, replace_lines, apply_patch, write_files, write_binary). An agent can immediately tell what this tool does and what it is not for.

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?

The description gives explicit when-to-use guidance ('Use this when the user asks to create or replace the complete contents of exactly one text file') and names the alternatives for other cases (edit_block, replace_lines, apply_patch, write_files, write_binary). This is exactly the kind of routing an agent needs.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources