Schema guard
Contract-test a JSON payload in one call: validate it against your schema, infer the schema the payload actually implies, diff the two to expose drift, and return a normalized pretty-print.
4 tools run server-side in one request: one payment, one response, and a partial-success envelope if a step fails. Free with proof-of-work (no wallet), or $0.004 in USDC over x402 or MPP.
When to use this pack
Before trusting a third-party or agent payload: does it still match the agreed schema, and which fields drifted if not?
Tools in this pack
Each is also callable on its own.
| Tool | Route |
|---|---|
| JSON Schema validate | POST /api/json-validate |
| JSON Schema infer | POST /api/json-schema-infer |
| JSON diff | POST /api/json-diff |
| JSON validate & format | POST /api/json-format |
Bought one at a time, these 4 tools cost $0.004 together; the pack is that sum less a 10% bundle discount, rounded up to the $0.001 settlement floor, which is $0.004.
Workflow
- Validate the payload against the expected schema with json-validate.
- Infer the schema the payload implies with json-schema-infer.
- Diff expected against inferred with json-diff: added, changed and dropped fields.
- Pretty-print a canonical copy with json-format.
Arguments
| Name | Required | Description | Example |
|---|---|---|---|
payload | yes | The JSON payload to check (as a JSON string) | {"id":1,"name":"Ada"} |
schema | no | The expected JSON Schema (as a JSON string; defaults to none) | {"type":"object","required":["id"]} |
What one call returns
A JSON object with pack, args, steps, summary; steps holds each tool's own result or error. Full example on the API page.
Call it directly
Any x402 client pays the 402 and gets the whole workflow back. With the agent402-client SDK (npm i agent402-client):
import { Agent402 } from "agent402-client";
// payFetch: an x402-wrapped fetch your wallet signs (@x402/fetch).
// Tools on the free tier need no options: new Agent402() pays them by proof-of-work.
// an existing prepaid credits key also works: new Agent402({ creditsKey })
const client = new Agent402({ fetch: payFetch });
const result = await client.call("skill-schema-guard", {"payload":"{\"id\":1,\"name\":\"Ada\"}","schema":"{\"type\":\"object\",\"required\":[\"id\"]}"});Run it in Claude
claude mcp add agent402 -s user -- npx -y agent402-mcp@0.17.2
Then paste this prompt:
Contract-test this JSON payload using Agent402's schema-guard skill pack: {"id":1,"name":"Ada"} against the expected schema {"type":"object","required":["id"]}. (1) Validate the payload against the schema, (2) infer the schema the payload actually implies, (3) diff expected vs inferred to expose drift, (4) return the normalized pretty-print. Report: valid or not (with violations), and every drifted field with its old vs new type.