Skip to main content
Glama

Write file

write_file

Creates or overwrites a file with the full content. Prefer edit_file for changes to existing files. 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.6/5.0
Behavior4/5

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

Annotations only supply generic hints (readOnly=false, destructive=false, openWorld=false), so the description carries real weight — and it delivers the conflict-detection behavior, the file_changed failure, and the recovery step (re-read, redo). There is mild tension with destructiveHint=false since "overwrites" discards prior content, though the base check arguably makes the operation safe; other failure modes and the 1MB content ceiling are left implicit.

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?

Three sentences, no filler: what it does, the alternative, then the safety protocol. The most decision-relevant constraints (overwrite scope, edit_file preference) are front-loaded before the versioning detail.

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?

With no output schema and only generic annotations, the description covers what an agent needs to call this safely: the alternative tool, the version parameter contract, and the conflict path. Minor gaps remain around directory creation and whether failures other than file_changed are possible.

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 50%, with path and content undocumented in the schema but self-evident by name. The description adds genuine meaning beyond the schema for `base`: version-from-read_file versus null-means-must-not-exist, plus the consequence of a stale value, which the schema only gestures at.

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 — "Creates or overwrites a file with the full content" — and immediately scopes it against the sibling edit_file. An agent can distinguish write_file from edit_file, read_file, and move_file without opening any schema.

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 names the alternative ("Prefer edit_file for changes to existing files") and gives the condition that selects it. It also prescribes when to pass base versus null, which is the key decision point for calling this tool correctly.

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