Skip to main content
Glama

Write file

write_file
Destructive

Creates or overwrites a file with the full content. Prefer edit_file for changes to existing files. Keep each write short (under about 150 lines): build a long page one section at a time, each section its own file placed in the page with a small edit_file, say one line to the user before each write, and change existing files with small edit_file replacements rather than rewriting them. A reply that is cut off loses only the step it was on: read what is saved and carry on (skill site-builder). Pass base (the version read_file gave) when overwriting a file you read, or null for a file that must not exist yet: if the file changed meanwhile, the write is refused with file_changed, so read it again and redo the change.

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

Input Schema

NameRequiredDescriptionDefault
baseNoThe file's version from read_file, or null for a new file that must not exist yet. Optional
pathYes
contentYes
projectIdYesProject id from list_projects

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and readOnlyHint=false, so the safety profile is known; the description goes well beyond that by disclosing the optimistic-concurrency contract (mismatched base is refused with file_changed, requiring a re-read and redo) and the practical size guidance of roughly 150 lines per write. It also explains recovery from a truncated reply, which is behavior an agent cannot infer from structured fields.

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

Conciseness3/5

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

The critical facts (overwrite semantics, edit_file alternative, base/concurrency) are front-loaded, but the middle is a long run-on clause mixing sectioning tactics, per-write narration to the user, and a 'skill site-builder' reference that reads as workflow instruction rather than tool definition. Tightening that stretch would preserve all the value at half the length.

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 four-parameter write tool with no output schema, the definition covers what is destroyed, how conflicts are reported and recovered, how large a single write should be, and which sibling to use instead. The remaining gap, the 1M-character content ceiling in the schema, is minor and already structured.

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 50%, and the description carries the most non-obvious parameter, base: its source (the version read_file returned), the null semantics for must-not-exist files, and the failure mode when it mismatches. path, content, and projectId remain undocumented in the description, though projectId has a schema description and the others are largely self-evident.

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 and resource plus scope: 'Creates or overwrites a file with the full content.' It immediately distinguishes itself from the nearest sibling by declaring that edit_file is the tool for changing existing files, so an agent can route without comparing schemas.

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 ('full content' creation/overwrite) and when-to-prefer-an-alternative ('Prefer edit_file for changes to existing files', 'change existing files with small edit_file replacements rather than rewriting them'). It also gives a concrete operating rule for the base parameter (pass the version from read_file vs. null for a file that must not exist).

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