Skip to main content
Glama

write_file

Create, overwrite, or append to files in VS Code and save changes to disk while preserving Undo history on open tabs.

Instructions

Create a new file with the given contents, overwrite an existing file, or append when Append is true. Automatically saves to disk in VS Code while preserving Undo history on open tabs.

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
PathYesThe absolute path of the file to create or write.
AppendNoWhether to append Content to the end of the file. Cannot be combined with Overwrite=true.
ContentYesThe full contents to write to the file.
OverwriteNoWhether to overwrite an existing file, replacing its entire contents.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description must carry the behavioral burden, and it does add real value by disclosing that changes are auto-saved to disk in VS Code and that Undo history on open tabs is preserved. It omits the risk profile of the destructive path (silent data loss on overwrite), whether missing parent directories are created, and what happens on error.

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?

Two compact sentences, front-loaded with the three operating modes, with the side-effect note trailing appropriately. No filler, though the mode list and the side-effect sentence could be split more cleanly for scanning.

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 four-parameter write tool with no output schema, the definition covers what the tool does, its modes, and its persistence side effect — enough to call it correctly. It is slightly thin on failure modes and on the overwrite risk, which matters for a destructive operation with no annotations.

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 coverage is 100%, so Path, Content, Append and Overwrite are already fully documented, including the Append/Overwrite exclusivity. The description restates the append/overwrite semantics at a high level without adding format, path-handling, or encoding detail beyond the schema, so baseline 3 applies.

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 pairs a specific verb with a specific resource and enumerates its three modes (create, overwrite, append), so an agent knows exactly what the tool does. It stops short of naming how it differs from the sibling edit_file, which is the most likely source of confusion for incremental changes.

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?

Usage is only implied by the mode enumeration: an agent can infer 'use this for whole-file writes' but is never told when to prefer edit_file for targeted changes, nor are prerequisites or exclusions stated. The Append/Overwrite conflict is left entirely to the schema.

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