Skip to main content
Glama

Apply JSON Patch (RFC 6902)

json_patch
Read-onlyIdempotent

Apply an RFC 6902 JSON Patch to a JSON document and return the result and its canonical SHA-256. Failed 'test' ops return 409 and are not charged. Price: 0.01 USDC per successful call on Base via x402 (pass the signed payment in _meta['x402/payment']; failed calls are not charged). HTTP equivalent: POST https://json-canon-x402.fly.dev/v1/json-patch.

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": {
      "document": "<document>",
      "patch": "<patch>"
    },
    "name": "json_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
patchYesRFC 6902 operations (add, remove, replace, move, copy, test). Max 10,000.
documentYesJSON value to patch (any type).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Annotations only declare read-only/idempotent/non-destructive; the description goes well beyond by disclosing error semantics (failed 'test' yields 409), the billing model (0.01 USDC per successful call on Base via x402), that failures are not charged, and where the signed payment must be placed. That is exactly the kind of context annotations cannot carry.

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 purpose and return values, then error semantics, then price and endpoint; each sentence carries distinct operational value. It is dense but not padded, though the pricing and HTTP-equivalent clauses make it slightly crowded for a two-parameter tool.

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 stateless transform with two fully documented parameters and no output schema, the description covers output (result plus SHA-256), failure behavior (409, uncharged), cost, payment mechanics, and an HTTP equivalent. An agent has everything needed to invoke it correctly.

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 both patch and document are already documented and the description correctly adds nothing redundant there. It does add meaning the schema omits: the required _meta['x402/payment'] channel, which is not represented in the input schema at all.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: apply an RFC 6902 JSON Patch to a JSON document, and names both return values (result and canonical SHA-256). It does not contrast itself with near neighbors like json_diff or validate_json, so an agent gets no explicit disambiguation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

Usage is implied by the RFC 6902 reference, and the description clarifies that failed 'test' ops return 409, but it never says when to prefer this tool over siblings such as json_diff or validate_json, nor any prerequisites for the caller.

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