Skip to main content
Glama

update_file

Destructive

Update one of the four root files. Always provide the COMPLETE file content, not a partial diff. The content is parsed before it is stored — if it has a syntax error, or if the composition is invalid, the file is NOT updated and the error is returned to you. Otherwise it is reformatted, committed, and applied to the live editor immediately, so you can screenshot the preview afterwards to check your work. Only these four names are accepted: a path like components/product-card/template.hbs is not a file and cannot be written here — use update_component. Changes are saved to the catalogue and can queue a thumbnail render that fetches external assets referenced by its content.

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": {
      "documentId": "<documentId>",
      "file": "<file>",
      "content": "<content>",
      "llm_model": "<llm_model>"
    },
    "name": "update_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesThe file to update
contentYesThe complete new content for the file
llm_modelYesThe exact model identifier you (the assistant) are running as, taken from your system prompt or environment (e.g. "claude-opus-4-8", "gpt-5.2"). Used for analytics only. If you do not know your model identifier with certainty, pass "unknown" — never guess.
documentIdYesThe catalogue's id. Call list_documents first if you do not have one.
conversation_idNoPass the exact conversation_id from the server's previous response, unchanged. The server provides it on the first call — never invent one, and do not issue parallel tool calls until you have it. Keep passing the same conversation_id for the rest of the conversation, including after later user messages or on a different task; do not reset it when the user starts a new request.
expectedRevisionNoThe contentRevision you read this file at. Always send it. Without it a write built from stale source can overwrite somebody else's edit or a lock they have just set.
activateComponentsNoOnly with file "template.hbs", and only when converting a legacy catalogue: switches the document to component mode in the same commit as the entry that composes the layouts. Rejected if the registry does not validate or the entry places no page layout. A document already in component mode ignores it, and nothing can switch a document back.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

With destructiveHint=true already declared, the description adds the substance an agent needs: content is parsed before storage, invalid syntax or composition aborts the write and returns the error, successful writes are reformatted, committed, and applied to the live editor immediately, and a thumbnail render may be queued that fetches external assets. These failure and side-effect semantics go well beyond the annotations.

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?

Front-loaded with the scope and the no-diff rule, then failure behavior, then side effects, then the sibling exclusion. Dense but every sentence carries information; the catalogue/thumbnail detail is the only part that could be trimmed without loss to selection.

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 destructive, open-world write with no output schema, the description covers validation, abort semantics, commit/apply behavior, and downstream render effects, plus the routing rule to update_component. Combined with the thorough schema, an agent has enough to invoke it correctly and recover from errors.

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%, including detailed descriptions for llm_model, conversation_id, expectedRevision, and activateComponents, so the schema does the heavy lifting. The description restates the four-name restriction and the complete-content rule, which the enum and content field already convey, adding little new parameter meaning.

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 ("Update one of the four root files") and immediately scopes it to exactly four accepted file names, explicitly distinguishing it from the sibling update_component for path-based component files. An agent can tell this apart from update_component without opening either 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?

Gives an explicit when-not plus the alternative: a path like components/product-card/template.hbs "is not a file and cannot be written here — use update_component". It also mandates full-content writes rather than diffs. It stops short of spelling out the read-then-write workflow (read_file / expectedRevision) in the description, leaving that to the schema.

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