Skip to main content
Glama

Write File

write_file
Destructive

Write base64-encoded content to a file, overwriting existing data and creating parent directories by default. Returns the written size and SHA-256 hash for verification.

Instructions

Write base64 content to a file, overwriting; creates parent dirs by default. Returns size and sha256 of the written bytes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoPOSIX permission bits for the new file, 0..0o7777 (default 0o644; ignored on Windows).
pathYesFile path; "~" expands to home.
mkdirsNoCreate missing parent directories (default true).
content_b64YesStandard base64 file content.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
pathNo
sizeNo
errorNo
sha256No

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=false, so the safety profile is covered structurally. The description earns credit by elaborating the actual destructive mechanic (overwrites existing files) and the mkdirs-by-default behavior, plus what the response contains, though it omits permission requirements and symlink handling.

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?

Two compact sentences with zero filler. The destructive write semantics are front-loaded in the first clause, and the return-value note is deferred to the end where it belongs.

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?

An output schema exists, so the tool needn't document return values in depth, and the description still notes size and sha256. Annotations cover the safety profile. The only real gap is the missing guidance on when to prefer exec_write over write_file.

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 description coverage is 100%, so all four parameters (mode, path, mkdirs, content_b64) are already documented in the schema. The description reinforces base64 content and the parent-dir default but adds no format, encoding, or edge-case detail beyond what the schema provides, making the baseline 3 correct.

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 ("Write base64 content to a file") and discloses two consequential behaviors: overwriting and automatic parent-dir creation. It is clearly distinguishable from read_file/list_dir, but it does not explicitly differentiate itself from the sibling exec_write, which an agent could reasonably confuse it with.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no statement of when to use this tool versus alternatives. With both write_file and exec_write in the sibling list, the absence of any routing guidance or preconditions (e.g., requires an existing/local filesystem context) leaves selection to guesswork.

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