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": "dtpr@2026-09-01-beta",
"datachain": { /* ResolvedDatachainInstance */ }
}
The schema_snapshot is bulky and has to agree with the placements, so take the whole datachain object straight from a resolve_datachain response rather than hand-writing it.
Output — valid
{
"structuredContent": {
"ok": true,
"data": { "ok": true, "warnings": [] },
"meta": { "content_hash": "sha256-…", "version": "dtpr@2026-09-01-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 matches neither a placement's element_instance_id nor a uniquely-placed element_id. |
element_provenance_ambiguous | A key in authoring_provenance.element_provenance matches an element_id placed more than once. Use element_instance_id on each placement and key the entry by that id. |
INSTANCE_ELEMENT_INSTANCE_ID_DUPLICATE | Two placements share the same element_instance_id. Must be unique within elements[]. |
INSTANCE_ELEMENT_INSTANCE_ID_COLLIDES_WITH_ELEMENT_ID | An element_instance_id matches an element_id placed on this instance. The two namespaces must be disjoint. |
variable_rationale_unknown_variable | A key inside an element_provenance[<id>].variable_rationale map references a variable not declared on the placed element's category. |
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
# A ResolvedDatachainInstance is too large to hand-write, so resolve a thin
# instance first and feed the result straight back in.
DC='{"id":"acme-resume-screener","schema_version":"dtpr@2026-09-01-beta","created_at":"2026-09-01T00:00:00Z","elements":[
{"element_id":"employment"},
{"element_id":"organization","context_type_id":"deployer","variables":[
{"id":"title","value":[{"locale":"en","value":"Acme Corp"}]},
{"id":"description","value":[{"locale":"en","value":"Runs the screener."}]}]},
{"element_id":"people","context_type_id":"subject","variables":[
{"id":"title","value":[{"locale":"en","value":"Job applicants"}]},
{"id":"description","value":[{"locale":"en","value":"Anyone who submits a resume."}]}]},
{"element_id":"recommends","context_type_id":"human_decides"}]}'
RESOLVED=$(curl -s https://api.dtpr.io/mcp -H 'content-type: application/json' \
--data "$(jq -nc --argjson dc "$DC" '{jsonrpc:"2.0",id:1,method:"tools/call",params:{name:"resolve_datachain",arguments:{version:"dtpr@2026-09-01-beta",datachain:$dc}}}')" \
| jq '.result.structuredContent.data')
curl -s https://api.dtpr.io/mcp -H 'content-type: application/json' \
--data "$(jq -nc --argjson r "$RESOLVED" '{jsonrpc:"2.0",id:2,method:"tools/call",params:{name:"validate_resolved",arguments:{version:"dtpr@2026-09-01-beta",datachain:$r}}}')"
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.