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.

$0.004 per call · one payment for the whole workflow
POST /api/skill/schema-guard
Sample output + API docs →

4 tools run server-side in one request. You pay once, settle once, and get a single response - no orchestration, no per-step payments, and a partial-success envelope if any step fails. USDC over x402 on any supported chain.

When to use this pack

An agent consuming a third-party API or another agent's structured output needs to know - before trusting the data - whether the payload still matches the agreed contract, and if not, exactly which fields drifted.

Tools in this pack

All 4 run inside the single $0.004 call above. Each is also callable on its own if you only need one part.

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

  1. Validate the payload against the expected schema with json-validate - the pass/fail verdict with the exact violation list.
  2. Infer the schema the payload actually implies with json-schema-infer - types, required keys, formats.
  3. Diff the expected schema against the inferred one with json-diff - the drift report: added fields, changed types, dropped keys.
  4. Normalize the payload with json-format for a canonical pretty-printed copy to log or store.

Arguments

NameRequiredDescriptionExample
payloadyesThe JSON payload to check (as a JSON string){"id":1,"name":"Ada"}
schemanoThe 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 one entry per tool (json-validate, json-schema-infer, json-diff, json-format), each with its 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 in one response. With the agent402-client SDK (npm i agent402-client, an ES module):

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@latest

Then paste this prompt into Claude:

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.

← All skill packs