Skip to main content
Glama

update_file

Replace a file's content with a new version; writes are rejected when the file changed since your last read, preventing overwrites of others' work.

Instructions

Replace a file's content as a new version. Call precheck_file first. Pass the version_id you read as base_version_id; if someone else changed the file meanwhile, the write is rejected instead of overwriting their work. The result lists approved knowledge your edit marked for re-checking. Requires a files:write key.

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": {
      "file_id": "<file_id>",
      "base_version_id": "<base_version_id>",
      "content": "<content>"
    },
    "name": "update_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentYesComplete new content (replaces the whole file).
file_idYesFile ID from list_files.
request_idNoOptional UUID to make retries idempotent; generated when omitted.
base_version_idYesThe version_id you last read. The write is rejected if the file changed since.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1-alpha.2

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does it well: it discloses optimistic concurrency (writes rejected on conflicting edits), the required files:write credential, whole-file replacement, and that the result surfaces knowledge marked for re-checking. These are non-obvious behavioral traits an agent could not infer from structured fields.

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?

Four short sentences, front-loaded with the operation, then prerequisite, then concurrency semantics, then auth. Dense but each sentence carries distinct information; no filler.

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?

Covers purpose, prerequisite, conflict handling, auth, and the nature of the return payload despite no output schema or annotations. It omits whether a new version_id is returned or what happens on idempotent retries, minor gaps for a write tool.

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 base_version_id, content, and request_id are already documented. The description reinforces base_version_id's meaning ('the version_id you read') and the conflict-rejection behavior, but mostly restates what the schema already says, so baseline 3 applies.

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 ('Replace a file's content') plus the key scope detail that it creates a new version, which distinguishes it from a create_file-style operation. An agent knows exactly what this mutates 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 Guidelines4/5

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

Explicitly requires calling precheck_file first and explains the base_version_id workflow, so sequencing is unambiguous. It does not state when to prefer create_file or other write paths instead, so it stops short of full alternative routing.

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