Skip to main content
Glama

as_json_patch

Generate a verified RFC 6902 JSON Patch that transforms one document into another, preserving keyed list item identity with remove/add/move operations.

Instructions

Generate an RFC 6902 JSON Patch that transforms document a into document b.

The patch is verified before it is returned: it is applied to a and the result is re-diffed against b (using the same options), so a patch that does not reproduce b is never returned. Lists are patched with remove/add/move so keyed items keep their identity. With ignore or tolerance options the patched a equals b only up to those options. NaN/Infinity cannot be expressed in JSON and are rejected.

Args: a, b: file paths, or the documents themselves when inputs='text'. inputs: 'files' (default) or 'text'; text requires an explicit format. format, array_match, array_keys, ignore, abs_tol, rel_tol, strip_comments, encoding: as in diff_files.

Input Schema

NameRequiredDescriptionDefault
aYes
bYes
formatNoauto
ignoreNo
inputsNofiles
abs_tolNo
rel_tolNo
encodingNoauto
array_keysNo
array_matchNoauto
strip_commentsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations supplied, the description carries real weight and does so well: it discloses that every patch is self-verified by applying it to a and re-diffing against b, that arrays use remove/add/move to preserve keyed item identity, that output is only equivalent up to ignore/tolerance options, and that NaN/Infinity are rejected. Remaining gaps are smaller — no mention of size limits, performance, or side effects (whether anything is written to disk) — which keeps it from a 5.

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 structure is front-loaded and logical: purpose first, then verification and array/edge-case semantics, then a compact args block. Nearly every sentence adds information, though the deferred 'as in diff_files' line is a low-value substitute for actual parameter meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return-format explanation is appropriately omitted, and the safety story is clear since the tool generates rather than applies a patch. However, for an 11-parameter tool with zero schema descriptions, leaving eight parameters to be looked up elsewhere means the definition is not fully self-contained.

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 description coverage is 0% across 11 parameters, so the description must compensate, and it only partly does. It clarifies a/b as file paths versus inline documents depending on inputs, and states that text mode requires an explicit format, but the remaining eight parameters (format, array_match, array_keys, ignore, abs_tol, rel_tol, strip_comments, encoding) are disposed of with 'as in diff_files' — a cross-reference that helps only if the agent has that sibling's documentation loaded.

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?

The first sentence names a specific verb and artifact: 'Generate an RFC 6902 JSON Patch that transforms document a into document b.' That is far more precise than a generic diff tool, but the description never explicitly contrasts itself with the listed siblings (diff_files, diff_text, apply_preview), leaving the agent to infer that this one emits a patch rather than a human-readable diff.

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 only implied: 'inputs: files (default) or text; text requires an explicit format' tells the agent which mode to pick, and the ignore/tolerance caveat hints at when the result is approximate. There is no explicit statement of when to call as_json_patch instead of diff_files or apply_preview, and no stated prerequisites or failure conditions beyond NaN/Infinity rejection.

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