Skip to main content
Glama

util_json_canonical

Read-only

JSON canonicalization (RFC 8785 JCS) + hash — Canonicalize JSON with the RFC 8785 JSON Canonicalization Scheme (keys sorted by UTF-16 code units, no whitespace, ECMAScript number form) and hash it (SHA-256 default; hash=sha384|sha512|sha1, hex + base64url) so you can sign, cache-key or de-duplicate JSON regardless of key order or formatting. json= (URL-encoded, max 100000 chars, 50000 values). Flags I-JSON problems: duplicate keys, integers beyond 2^53, numbers with more than 17 significant digits, unpaired surrogates, -0. b= a second document to test semantic equality (same canonical bytes) with the first differing offset. pretty=true adds a key-sorted indented version. Parse errors -> 422 with line/column. Offline, no data stored. Price: $0.001 USDC (Base, via x402).

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": {
      "json": "<json>"
    },
    "name": "util_json_canonical"
  }
}

Input Schema

NameRequiredDescriptionDefault
jsonYes{"b":[1.0,2e3,{"z":true,"a":null}],"a":"hi"}

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Beyond the annotations, it discloses determinism guarantees, I-JSON problem flags reported (duplicate keys, >2^53 integers, >17 significant digits, unpaired surrogates, -0), 422 with line/column on parse errors, the optional pretty output, and that no data is stored. The statement 'Offline' sits in tension with openWorldHint=true and the x402 network payment, but this reads as a data-handling claim rather than an outright contradiction of the safety profile.

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 core operation and the hashing rationale are front-loaded in the first sentence, and the I-JSON, comparison, pretty, error and pricing details follow in a logical order. It is dense to the point of being run-on, with several clauses packed into a single block, but almost every clause carries operational information.

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?

With no output schema, the description still covers input format and limits, output form (hex + base64url canonical hash), the b= comparison result with differing offset, error behavior (422 with line/column), and cost. For a single-parameter utility this is complete enough for an agent to call it correctly without further exploration.

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?

Schema coverage is 100% for the single 'json' property, yet the description adds substantial meaning the schema cannot: URL-encoded input, 100000-char and 50000-value limits, plus parameters absent from the schema entirely (hash=sha384|sha512|sha1, b= second document, pretty=true). It also explains what b= returns, namely the first differing offset.

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?

States a specific verb and resource: canonicalize JSON per RFC 8785 JCS and hash the result. It names the exact algorithm (UTF-16 code-unit key sort, no whitespace, ECMAScript number form) and the default hash (SHA-256), which distinguishes it cleanly from siblings such as util_json_diff, util_checksum, or util_json_schema.

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

Usage Guidelines4/5

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

It gives concrete motivating scenarios (sign, cache-key, de-duplicate JSON regardless of key order or formatting) and explains that the b= parameter is the way to test semantic equality between two documents. It does not explicitly tell the agent when to prefer a sibling diff or comparison tool instead, so guidance is clear but lacks stated exclusions.

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