Skip to main content
Glama

write_text_file

Create UTF-8 text files or replace their full content with conflict-safe overwrites; use a base SHA-256 when updating non-empty files and keep old versions in history.

Instructions

Create a UTF-8 text file, or replace the whole content of one (at most 2 MiB). Overwriting a non-empty file needs base_sha256 from read_text_file; the old content stays in version history.

Input Schema

NameRequiredDescriptionDefault
nameNonew file name, with parent_id or parent_path
pathNoabsolute file path; created when missing (its folder must exist)
contentYesfull UTF-8 content, at most 2 MiB
node_idNoexisting text file UUID instead of path
parent_idNofolder UUID for a new file, with name
base_sha256Nosha256 from read_text_file or get_file_info; required to overwrite a non-empty file, fails with EDIT_CONFLICT if it changed since
parent_pathNofolder path for a new file, with name

Output Schema

NameRequiredDescriptionDefault
idYes
kindYes
mimeNo
nameYes
pathNo
sizeNo
sha256No
createdYes
parent_idNo
updated_atYes
stats_staleNo
subtree_bytesNo
subtree_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

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

Goes well beyond the single destructiveHint=false annotation: it discloses the 2 MiB size limit, the optimistic-concurrency contract (EDIT_CONFLICT if base_sha256 changed), and the recovery property that old content remains in version history. These are exactly the mutation-side risks an agent needs, and nothing here contradicts the non-destructive annotation.

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 dense sentences with the create-vs-replace distinction front-loaded and the safety constraint immediately after. No filler, no restatement of the tool name, and the parenthetical size limit sits where it is most useful.

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 7-parameter mutation tool, the description covers the key risks (size cap, conflict, reversibility) while the schema and output schema handle parameter and return-value detail. It does not spell out the three alternative target-addressing modes (node_id vs path vs name+parent), though those are fully documented in the schema.

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 the schema already explains every parameter, including base_sha256's provenance and conflict behavior. The description reinforces the hash requirement and size cap but adds no addressing guidance beyond what the schema states for name/path/node_id.

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?

States a specific verb and resource ('Create a UTF-8 text file, or replace the whole content of one') with a concrete scope limit of 2 MiB. It implicitly separates itself from read_text_file and binary upload paths, but never names siblings like prepare_upload or create_file_request, so differentiation is inferred rather than stated.

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

Usage Guidelines4/5

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

Provides an actionable precondition: overwriting a non-empty file requires base_sha256 obtained from read_text_file, which routes the agent to the correct sibling first. It lacks explicit when-not guidance (e.g., use a different tool for binary or oversized files), but the 2 MiB cap and hash requirement cover most selection decisions.

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