{
  "name": "json.canonical",
  "group": "data",
  "summary": "Canonicalize JSON (RFC 8785) and content-address it with SHA-256 and a CIDv1.",
  "description": "Serializes a JSON document to its one canonical form — keys sorted, whitespace dropped, numbers in ECMAScript form — then hashes it. Two documents that mean the same thing produce the same digest regardless of key order or formatting, which is what makes the digest quotable as a receipt. A log line is a claim that the process which wrote it could also edit; a content address is computed from the content, so changing the content changes the address. Pair it with crypto.verify: canonicalize, sign the digest with your own key, and anyone can check the pair without trusting either of you.",
  "keywords": [
    "canonical json",
    "rfc 8785",
    "jcs",
    "content address",
    "cid",
    "sha256 json",
    "deterministic hash",
    "receipt",
    "attestation",
    "audit",
    "tamper evident",
    "stable digest"
  ],
  "endpoint": "https://fluentedi.com/v1/json/canonical",
  "mcp_name": "json_canonical",
  "makes_network_request": false,
  "parameters": {
    "type": "object",
    "properties": {
      "json": {
        "description": "The JSON document, as an object or a JSON string.",
        "maxLength": 1000000
      },
      "include_canonical": {
        "description": "Include the canonical serialization itself, not just its digest.",
        "type": "boolean",
        "default": true
      }
    },
    "required": [
      "json"
    ],
    "additionalProperties": false
  },
  "examples": [
    {
      "description": "Same meaning, different key order — same digest",
      "url": "https://fluentedi.com/v1/json/canonical?json=%7B%22b%22%3A2%2C%22a%22%3A1%7D",
      "args": {
        "json": "{\"b\":2,\"a\":1}"
      }
    },
    {
      "description": "Content-address a tool call for an audit trail",
      "url": "https://fluentedi.com/v1/json/canonical?json=%7B%22tool%22%3A%22transfer%22%2C%22args%22%3A%7B%22amount%22%3A100%2C%22to%22%3A%22B%22%2C%22from%22%3A%22A%22%7D%7D",
      "args": {
        "json": "{\"tool\":\"transfer\",\"args\":{\"amount\":100,\"to\":\"B\",\"from\":\"A\"}}"
      }
    }
  ],
  "suggestion": null
}