Skip to main content
Glama

write_files

Destructive

Apply coordinated edits across multiple files atomically, validating each change before writing and restoring files if any write fails.

Instructions

Apply a coordinated change across SEVERAL files, all-or-nothing. Use this instead of calling edit_file/rewrite_file in a loop whenever the edits belong together — converting call sites to a new helper, renaming a symbol across chapters, updating a template and its users. A loop that fails halfway leaves the project in a state that is neither old nor new, and you find out when the compile breaks.

Every edit is validated and resolved BEFORE anything is written, so the common failures (missing file, search string matching twice or not at all, bad path) touch nothing. If a write still fails, the files already written are restored. Each entry takes either content (full replacement) or old_string+new_string (surgical, must match exactly once).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesThe edits to apply together.
project_idYesTypleaf project ID — a 24-character lowercase hex string (e.g. '692a83fb82feceb233c4b0e7'), obtained from list_projects or the project URL. NOT a local filesystem path, NOT '.', NOT a project name or title. These tools operate on the REMOTE Typleaf project. Only call these tools when the user explicitly asks to work with a Typleaf project — never for general local file I/O. If you already have a copy of THIS project checked out on the local filesystem, prefer the standard read/grep tools against that path. Always call list_projects first when unsure.
commit_messageNo
Behavior5/5

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

Annotations only mark destructiveHint=true, but the description discloses the atomic all-or-nothing behavior, validation-before-write, rollback on failure, and the two edit modes (content vs old_string/new_string). This goes well beyond the annotations and describes exactly what happens on failure and how edits are resolved.

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 concise paragraphs that front-load the core purpose and then elaborate on behavior and modes. The language is efficient and free of fluff, though the second paragraph could be slightly more structured (e.g., bullet points for the modes), but overall it is appropriately sized.

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 complex multi-file atomic write tool with no output schema, the description covers all essential behavioral aspects: atomicity, pre-validation, rollback, and the parameter semantics for each edit type. It also contrasts with sibling tools, making it sufficient for an agent to call correctly without additional documentation.

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?

The description explains the meaning of the two edit modes (full replacement vs surgical match) and that old_string must match exactly once, which is not fully clear from the schema alone. However, it does not discuss the commit_message parameter at all, and the project_id parameter is described in its own schema entry, not in the tool description, so some semantics are delegated to the schema.

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?

States a specific verb (apply) and resource (coordinated change across several files) and explicitly contrasts with edit_file/rewrite_file loops. The 'all-or-nothing' qualifier adds precision and differentiates it from simple file writes.

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?

Directly instructs when to use this tool ('instead of calling edit_file/rewrite_file in a loop whenever the edits belong together') and gives concrete examples (converting call sites, renaming symbols, updating templates). Also explains the pitfall of a loop (project left in inconsistent state), which makes the usage guidance actionable.

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/superzeldalink/typleaf-mcp'

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