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

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
datafileYes
public_urlNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A5/5.0
Behavior5/5

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

The description goes well beyond the annotations (which only flag destructiveHint=true and readOnlyHint=false). It discloses the concurrency safety mechanism ('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'), schema validation ('a patch that would break the schema is rejected and nothing is written'), property order preservation ('untouched parts of the document come back byte-identical'), and the exact failure modes for sha256 checks. No annotation contradiction exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every sentence earns its place given the tool's complexity. It front-loads the core purpose, then systematically covers operations, encoding, integrity, concurrency, schema validation, property order, and republish. The structure is logical and scannable, with no filler or repetition. For a tool with five parameters and four operation types, this level of detail is warranted.

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 tool's complexity (multiple ops, path syntax, encoding options, sha256 guards, concurrency semantics) and the presence of a rich output schema, the description covers everything an agent needs to call it correctly: operation semantics, path addressing, value encoding, integrity checks, concurrency safety, schema validation, and republish behavior. The only omission is the exact return shape, which the output schema already provides, so nothing critical is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although the input schema covers 100% of parameters, the description adds substantial meaning beyond the field descriptions: it explains the dot-path syntax with concrete examples (e.g., 'posts[slug=hello].title' and 'posts[-]' for append), the rationale for base64/gzip encoding to avoid transcription corruption, the dual role of value_sha256 as a transmission check and a precondition, and the required vs optional nature of expected_content_sha256 based on path type. This turns raw parameters into a coherent mental model.

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 opens with a specific verb and resource: 'Edit an EXISTING datafile's JSON in place without resending the whole document' and immediately distinguishes it from update_datafile ('SAFER than update_datafile, not just cheaper'). It enumerates the exact operation types (set/remove/replace_in/test) and path syntax, leaving no ambiguity about what the tool does or how it differs from its sibling.

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?

It states when to use this tool versus alternatives explicitly: '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', contrasts it with update_datafile, and gives conditions for republish ('Errors if it has never been published (use publish_datafile with an explicit public_path first)'). It also explains when to prefer replace_in over a full value and when to use base64 encoding, covering both positive and negative selection.

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