Skip to main content
Glama

write_file

Creates or replaces files and parent directories, with overwrite or append controls for existing files.

Instructions

Create or replace a file. Parent directories are created. Set Overwrite or Append when the file exists.

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

Input Schema

NameRequiredDescriptionDefault
PathYesAbsolute path of the file.
AppendNoAppend to an existing file.
ContentYesFull contents to write.
OverwriteNoReplace an existing file.
ArtifactMetadataNoIgnored. Omit for ordinary files.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full behavioral burden. It usefully discloses that parent directories are created as a side effect, but omits whether Overwrite is destructive/irreversible, whether the default behavior on an existing file is an error, and whether any path permissions are required. An output schema exists, so return values need not be explained here.

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 short sentences, front-loaded with the core action, then the directory side effect, then the flag condition. No filler wording and nothing repeated from the schema.

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

Completeness3/5

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

For a five-parameter write tool with no annotations, the definition covers the essentials but leaves a meaningful gap: the behavior when the file exists and neither Overwrite nor Append is set, and the destructive nature of replacement. Presence of an output schema offsets the need to describe results.

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 100%, so the baseline is 3, but the description adds non-obvious conditional meaning: Overwrite and Append are only relevant when the target file already exists, which the schema does not state. It does not clarify the 'Ignored' ArtifactMetadata parameter, but that is already documented as ignorable in the schema.

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 uses a specific verb and resource ('Create or replace a file'), which is unambiguous and lets an agent distinguish it from read_file or edit_file. It stops short of explicitly naming the nearest sibling (edit_file), so differentiation relies on the agent's inference that 'replace' means whole-file writes rather than edits.

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?

The sentence 'Set Overwrite or Append when the file exists' gives real conditional guidance for choosing between the two mode flags. However, there is no guidance on when to pick this tool over edit_file, which matters when both could write content, and no statement about what happens if the file exists and neither flag is set.

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