← All procedures
json.patch
Apply an RFC 6902 JSON Patch to a JSON value
MCPCLI- Package
- @procedures/json · README
- Path
["json","patch"]- CLI
mark json patch --value <any> --patch <object[]>- MCP tool
json.patch on the dev-tools server- As data
{"$proc":["json","patch"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/json/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["json","patch"], { value: "<value>", patch: [] });
console.log(JSON.stringify(result));From the command line
$ mark json patch --value <any> --patch <object[]>
As data, in a program
{
"$proc": ["json", "patch"],
"input": { "value": "<value>", "patch": [] }
}Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"value": {
"description": "The JSON value to change"
},
"patch": {
"type": "array",
"items": {
"type": "object",
"properties": {
"op": {
"type": "string",
"enum": [
"add",
"remove",
"replace",
"move",
"copy",
"test"
],
"description": "The operation"
},
"path": {
"type": "string",
"description": "The JSON Pointer of the location"
},
"from": {
"description": "The JSON Pointer of the source of move and copy",
"type": "string"
},
"value": {
"description": "The value of add, replace and test"
}
},
"required": [
"op",
"path"
]
},
"description": "The operations of the JSON Patch (RFC 6902), in order"
}
},
"required": [
"value",
"patch"
]
},
"output": {
"type": "object",
"properties": {
"value": {
"description": "The value after the patch"
}
},
"required": [
"value"
],
"additionalProperties": false
}
}