Skip to main content
Glama

Patch datafile

patch_datafile
Destructive

Edit an EXISTING datafile's JSON in place without resending the whole document — the right tool for changing one field of a large datafile, appending a blog post to a list, or fixing a word in a long string. Apply ordered operations (set / remove / replace_in / test) addressed by a dot-path from the document root (e.g. 'posts[slug=hello].title', or 'posts[-]' with op 'set' to APPEND). Pass values as raw JSON — the platform owns the escaping. For a SMALL change to a LARGE string use replace_in (find→replace, must match exactly once) so you send a few bytes. For a large NEW value send it with value_encoding=base64 (or gzip+base64) plus a value_sha256, so transcription damage is rejected instead of silently written. This is SAFER than update_datafile, not just cheaper: the patch is applied to the content it just read and the write is gated on that exact content, so a concurrent write is always reported rather than clobbered — no read-modify-write race, even with no arguments from you. The result is validated against the datafile's bound schema before it lands; a patch that would break the schema is rejected and nothing is written. Property order is preserved: untouched parts of the document come back byte-identical, so the change you make is the whole diff. Set republish=true to push the result to the CDN path it was last published at.

Input Schema

NameRequiredDescriptionDefault
slugNothe datafile slug (provide this or datafile_id)
republishNoafter patching, re-publish to the CDN path this datafile was last published at. Errors if it has never been published (use publish_datafile with an explicit public_path first); the patch still applied.
operationsYesordered edits applied to the datafile's stored JSON
datafile_idNothe datafile id (provide this or slug)
expected_content_sha256Nothe content_sha256 from the get_datafile you built these operations from. If the stored content has moved since, the patch is REFUSED — nothing is applied, nothing is written. REQUIRED when any path addresses an array element by numeric index (items[2]), because that is a claim about the document's current shape whose failure is otherwise SILENT: if an element shifted, the write is still internally consistent and edits the wrong one. Optional for self-locating paths — items[slug=my-post], items[-] (append), or a plain key — which mean the same thing whatever the document holds, so appending to a large collection needs no read. Independently of this argument, the write is always gated on the content the patch itself just read, so it can never clobber a concurrent write.

Output Schema

NameRequiredDescriptionDefault
datafileYes
public_urlNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

The description adds substantial behavior beyond the annotations: it explains optimistic concurrency gating, schema validation before write, byte-identical preservation of untouched content, append semantics, and republish failure behavior. These details materially help an agent understand the write's safety and side effects.

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?

The description is front-loaded with purpose and use cases, and most sentences add relevant information. It is dense and long for a tool description, but the complexity of patching, validation, encoding, and concurrency justifies most of the length.

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?

Given the rich schema, annotations, and output schema, the description is complete enough for an agent to invoke the tool correctly. It covers the operation model, safety model, encoding guidance, schema validation, and republish behavior without needing to explain return values.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds useful semantic context for operations, dot-paths, append syntax, replace_in exact-match requirements, and base64 encoding for large values. It does not need to repeat every parameter detail, but it meaningfully supplements 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?

The description states a specific verb and resource: editing an existing datafile's JSON in place without resending the whole document. It explicitly distinguishes the tool from update_datafile and names concrete use cases, so an agent can identify it 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?

It clearly says when this is the right tool, such as changing one field of a large datafile or appending to a list, and contrasts it with update_datafile as the safer alternative. It lacks an explicit statement of when update_datafile would be preferable, so it falls short of full when/when-not guidance.

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