Tools
MCP tool: validate_resolved
Validate a ResolvedDatachainInstance against its referenced schema.
validate_resolved
Soft-failure (
isError: false) on every validation outcome. ok: true and ok: false are both successful tool calls — the answer is in the envelope.Summary
MCP sibling to POST /schemas/:version/validate_resolved. Validates a snapshot-pinned ResolvedDatachainInstance end-to-end:
- Element-id resolution against
schema_snapshot.elements∪suggested_elements(snapshot wins; collision is a hard error). - R14 wire enforcement: non-empty
suggested_elementsrequiresauthoring_provenance.kind === 'ai_generated'. - Existing semantic rules (cardinality, required categories, context refs) operating against the merged element pool.
- Snapshot consistency vs the live store, when the pinned version is still served (R9).
Input
{
"version": "ai@2026-04-16-beta",
"datachain": { /* ResolvedDatachainInstance */ }
}
Output — valid
{
"structuredContent": {
"ok": true,
"data": { "ok": true, "warnings": [] },
"meta": { "content_hash": "sha256-…", "version": "ai@2026-04-16-beta" }
}
}
Output — invalid
{
"structuredContent": {
"ok": false,
"errors": [
{
"code": "element_id_collision",
"message": "id 'foo' present in both schema_snapshot.elements and suggested_elements",
"path": "suggested_elements"
}
]
}
}
Error codes
| Code | Meaning |
|---|---|
parse_error | Resolved-form Zod parse failed. |
element_id_collision | Same id in schema_snapshot.elements and suggested_elements (R15a). |
provenance_required | Non-empty suggested_elements without authoring_provenance.kind === 'ai_generated' (R14). |
element_provenance_unknown_element | A key in authoring_provenance.element_provenance does not match any placement element_id. |
unknown_element_id | Placement element_id absent from snapshot ∪ suggested (R15 fallthrough miss). |
snapshot_drift | schema_snapshot differs from canonical; skipped when the pinned version is no longer in the index. |
| Semantic validator codes | Shape-valid but semantically wrong (REQUIRED_CATEGORY_MISSING, etc.). |
Example
curl -s https://api.dtpr.io/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
--data '{
"jsonrpc":"2.0","id":1,
"method":"tools/call",
"params":{
"name":"validate_resolved",
"arguments":{
"version":"ai@2026-04-16-beta",
"datachain": {
"schema_version":"ai@2026-04-16-beta",
"elements":[{"element_id":"accept_deny"}],
"schema_snapshot":{ "datachain_type": { /* ... */ }, "categories":[/*...*/], "elements":[/*...*/] },
"suggested_elements":[]
}
}
}
}'
See also
- REST
POST /schemas/:version/validate_resolved— same validator over plain HTTP. - MCP
resolve_datachain— produces the form this tool validates. - MCP
validate_datachain— thin-form validator. - Datachains — both wire forms and the trust boundary.