Skip to main content
Glama

write

Write file content and instantly update the cache so reads and searches see the new text. Supports append, diff preview, and auto-formatting.

Instructions

Create a file or replace its entire contents.

Use this for new files or full rewrites; for localized changes prefer edit or batch_edit. Status is created for a new path or updated for an existing one, and an update returns a unified diff against the previous content. Writing refreshes the cache so later reads, grep, and search see the new text. The response carries the new content_hash; pass it back as read's known_hash to get unchanged instead of re-reading the file you just wrote. Missing parent directories are created unless create_parents=false.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to create or replace (absolute, or relative to root).
appendNoAppend `content` to the end of the file instead of overwriting.
contentYesFull file content, or the text to append when `append=true`.
dry_runNoPreview the result without writing.
show_diffNoReturn the unified diff even on a deterministic write.
auto_formatNoRun the formatter after writing.
create_parentsNoCreate any missing parent directories.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
diffNo
pathNo
statusNo
createdNo
dry_runNo
truncatedNo
diff_stateNo
diff_statsNo
from_cacheNo
content_hashNo
diff_omittedNo
tokens_savedNo
bytes_writtenNo
tokens_writtenNo
Behavior5/5

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

No annotations provided, so description bears full burden. It discloses status ('created'/'updated'), returns unified diff on updates, refreshes cache for other tools, provides content_hash, and explains the known_hash optimization for read.

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?

Concise and front-loaded: first sentence states purpose, subsequent sentences add essential details (usage, status, diff, cache, hash) without any filler.

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?

Covers all key behavioral aspects: return status and diff, cache invalidation, content_hash and interaction with read, and creation of parent directories. Output schema exists but description still explains important output fields.

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 baseline is 3. Description adds minimal extra meaning beyond schema parameters (e.g., emphasizing create_parents default), but does not significantly deepen understanding of each parameter beyond what schema already offers.

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?

Clearly states the tool creates or replaces file contents, uses specific verb+resource, and distinguishes from siblings by referencing 'edit' and 'batch_edit' for localized changes.

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?

Explicitly advises to use for new files or full rewrites and to prefer 'edit' or 'batch_edit' for localized changes. Also notes behavior for missing parent directories.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoderDayton/semantic-cache-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server