Skip to main content
Glama

Create or overwrite a file

write_file
DestructiveIdempotent

Creates a new text file (.tex, .bib, .sty, .cls, .txt, .md and the like), or replaces a whole existing one. For a change to part of a file use edit_file instead; images and PDF figures go in with add_image. Overwriting changes only the parts that differ, tracked or not as the person's switch for you in this project says, and the previous text stays in History.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "project_id": "<project_id>",
      "path": "<path>",
      "content": "<content>"
    },
    "name": "write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesThe file's path in the project, e.g. sections/method.tex; folders are created as needed.
contentYesThe file's complete new text.
project_idYesThe project's id, from list_projects.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / content / description
      Added value: +"The file's complete new text."
    • addedInput schema / properties / path / description
      Added value: +"The file's path in the project, e.g. sections/method.tex; folders are created as needed."
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, so the safety profile is known; the description adds real value on top by explaining that an overwrite is diff-based ('changes only the parts that differ') and that prior text remains recoverable in History. That materially softens the destructive flag an agent would otherwise over-worry about. It stops short of describing failure modes, permission requirements, or whether an unchanged overwrite is a no-op.

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?

Three tight sentences, front-loaded with the core action and then routing to alternatives. The trailing clause about 'the person's switch for you in this project' is slightly convoluted and takes a moment to parse, but carries real information.

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 3-parameter write tool with no output schema and full schema coverage, the description covers creation, whole-file replacement, alternative routing, and recoverability of prior content. Only error/conflict behavior and any return value remain unspecified, which is a minor gap.

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 documents path (with example and auto-created folders), content as the complete new text, and project_id. The description adds only the implicit notion that content is the whole file, which the schema already states. Baseline 3 is appropriate.

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 and resource (create or replace a text file) and bounds the scope by listing the file extensions it handles. It also explicitly names what it is not: edit_file for partial changes, add_image for images/PDFs. An agent can distinguish it from every relevant sibling without opening the schema.

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?

Gives explicit routing: use this for full-file creation or whole-file replacement, use edit_file for changes to part of a file, use add_image for binary figures. The alternative and the condition that selects it are both stated, leaving nothing to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources