What it does
Post an LLM output string and a JSON Schema; receive a binary valid/invalid verdict plus a hint describing the validation failure. Use this as the last step before treating LLM output as structured data. Prevents downstream type errors, broken pipelines, and hallucinated field names from propagating.
When to use it
- Validate LLM-generated JSON before inserting into a database
- Gate a multi-step pipeline on schema compliance
- Retry loops: validate → retry if invalid
Request schema
{
"response": "{\"name\": \"Acme Corp\", \"revenue\": \"not a number\"}",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"revenue": {
"type": "number"
}
},
"required": [
"name",
"revenue"
]
}
} Response schema
{
"valid": false,
"hint": "revenue: expected number, got string"
} Code example — TypeScript via MCP
Install the MCP server once; all 16 services become tool calls.
// Configure @melis-ai/x402-tools-mcp in your MCP client
// Then call the tool:
const result = await mcpClient.callTool("schemagate", {
"response": "{\"name\": \"Acme Corp\", \"revenue\": \"not a number\"}",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"revenue": {
"type": "number"
}
},
"required": [
"name",
"revenue"
]
}
});
console.log(result);
// ["valid","hint"]... → MCP setup guide Code example — Python via direct HTTP
import requests
# x402 payment header must be set by your wallet client
# See x402.org for client libraries
headers = {
"Content-Type": "application/json",
"x-payment": "<signed-x402-payment-header>",
}
resp = requests.post(
"https://schemagate.melis.ai/validate-schema",
json={
"response": "{\"name\": \"Acme Corp\", \"revenue\": \"not a number\"}",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"revenue": {
"type": "number"
}
},
"required": [
"name",
"revenue"
]
}
},
headers=headers,
)
print(resp.json()) Code example — curl with internal key bypass
For testing with an issued internal key (skips x402 payment flow):
curl -X POST https://schemagate.melis.ai/validate-schema \
-H "Content-Type: application/json" \
-H "x-internal-key: YOUR_KEY" \
-d '{"response":"{\"name\": \"Acme Corp\", \"revenue\": \"not a number\"}","schema":{"type":"object","properties":{"name":{"type":"string"},"revenue":{"type":"number"}},"required":["name","revenue"]}}' FAQ
Does it work without an account?
Yes. x402 is account-less. Your agent's wallet signs the payment and retries automatically. No registration, no API key, no subscription.
What happens on failure?
Returns HTTP 422 if schema is invalid JSON Schema.
What is the rate limit?
None published.
Is this open-source?
The service code is closed-source for security reasons. The MCP wrapper that calls it is open-source and MIT-licensed: github.com/mizukaizen/x402-tools-mcp .
Who built this?
Part of the melis.ai agent infrastructure stack. Running on a dedicated Helsinki VPS since early 2026. Contact sean@melis.ai.