Skip to main content
Glama

Write file

write_file
Destructive

Creates a new file or overwrites an existing file with exact content, automatically creating parent directories. Use for full file writes when targeted edits are not needed.

Instructions

Create a file (parent directories are created automatically) or overwrite an existing file with exactly the given content. Use this for new files or full rewrites. Prefer edit_file or patch for targeted changes to existing files, because this tool replaces the whole file and is not reversible. The file is written to disk immediately.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesWorkspace-relative path of the file to write. Absolute paths inside the workspace are also accepted.
contentYesExact file content to write, as a UTF-8 string.
workspaceNoWorkspace name (see workspace_list). Defaults to the primary workspace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.0

TDQS

A4.9/5.0
Behavior5/5

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

Beyond destructiveHint=true and readOnlyHint=false, the description reveals that parent directories are auto-created, writes are immediate, the whole file is replaced, and the operation is not reversible. These are behavioral facts an agent needs and would not know from annotations alone.

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 dense sentences, no filler, with the core action and key auto-directory behavior front-loaded, followed by usage routing and a caution about irreversibility. Every sentence earns its place.

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 3-parameter write tool with fully documented parameters and annotations, the description completes the picture: it covers side effects, timing, irreversibility, and sibling routing. No necessary information is missing for correct invocation.

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; the description adds a new parameter-level behavior for path ('parent directories are created automatically') and emphasizes exact-content semantics for content, taking it just above baseline.

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 opens with a specific verb and resource ('Create a file ... or overwrite an existing file') and explicitly scopes it to 'new files or full rewrites.' It names edit_file and patch as distinct alternatives, so an agent can immediately tell this tool apart from siblings.

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?

It gives explicit when-to-use ('new files or full rewrites') and when-not-to-use ('Prefer edit_file or patch for targeted changes'), with the reason being that this tool replaces the whole file. This is textbook usage routing.

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