{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://usedeed.app/contracts/deed.mcp.public_tool_results.v1.schema.json",
 "title": "DEED public MCP tool results",
 "description": "Contract for /oss/mcp read-only tool result payloads that do not already use public operator schemas.",
 "oneOf": [
  {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "schema_version",
    "strategies",
    "count",
    "mode"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.strategies.v1"
    },
    "strategies": {
     "type": "array",
     "minItems": 1,
     "items": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "name",
       "risk",
       "mode",
       "description"
      ],
      "properties": {
       "name": {
        "type": "string",
        "minLength": 1
       },
       "risk": {
        "enum": [
         "none",
         "low",
         "medium",
         "high"
        ]
       },
       "mode": {
        "enum": [
         "paper",
         "paper-first"
        ]
       },
       "description": {
        "type": "string",
        "minLength": 10
       }
      }
     }
    },
    "count": {
     "type": "integer",
     "minimum": 1
    },
    "mode": {
     "enum": [
      "paper",
      "paper-first"
     ]
    }
   }
  },
  {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "schema_version",
    "invariants",
    "commercial_boundary"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.safety_catalog.v1"
    },
    "invariants": {
     "type": "array",
     "minItems": 5,
     "items": {
      "type": "string",
      "minLength": 10
     }
    },
    "commercial_boundary": {
     "type": "string",
     "pattern": "DEED Protocol services"
    }
   }
  },
  {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "schema_version",
    "repository",
    "docs",
    "proof_status"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.public_proof.v1"
    },
    "repository": {
     "anyOf": [
      {
       "type": "string",
       "format": "uri"
      },
      {
       "const": "pending",
       "description": "OSS release gate: repo private until the DEED release; pending instead of a 404 link (canon rule 5)"
      }
     ]
    },
    "docs": {
     "type": "object",
     "additionalProperties": false,
     "required": [
      "llms",
      "oss_mcp"
     ],
     "properties": {
      "llms": {
       "type": "string",
       "format": "uri"
      },
      "oss_mcp": {
       "type": "string",
       "format": "uri"
      }
     }
    },
    "proof_status": {
     "type": "string",
     "minLength": 10
    },
    "repository_status": {
     "enum": [
      "public",
      "pending"
     ]
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "entries",
    "stats",
    "week",
    "source"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.arena.v1"
    },
    "entries": {
     "type": "array"
    },
    "stats": {
     "type": "object"
    },
    "week": {
     "type": "object"
    },
    "source": {
     "enum": [
      "public_operator",
      "live",
      "seeded",
      "error"
     ]
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "source",
    "public_operators",
    "season",
    "leaderboard",
    "operator"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.season.v1"
    },
    "source": {
     "enum": [
      "public_operator",
      "leaderboard"
     ]
    },
    "public_operators": {
     "type": "integer",
     "minimum": 0
    },
    "season": {
     "type": "object"
    },
    "leaderboard": {
     "type": "array"
    },
    "operator": {
     "type": "object"
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "name",
    "version",
    "transport",
    "boundary",
    "safety",
    "tools"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.status.v1"
    },
    "name": {
     "const": "deed-oss"
    },
    "version": {
     "type": "string",
     "minLength": 1
    },
    "transport": {
     "const": "streamable-http"
    },
    "boundary": {
     "const": "public-read-only"
    },
    "safety": {
     "type": "object",
     "required": [
      "orders",
      "runtime_mutation",
      "secrets",
      "live_account_state"
     ],
     "properties": {
      "orders": {
       "const": false
      },
      "runtime_mutation": {
       "const": false
      },
      "secrets": {
       "const": false
      },
      "live_account_state": {
       "const": false
      }
     }
    },
    "tools": {
     "type": "integer",
     "minimum": 24
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "kind",
    "mcp_tools",
    "safety_boundary"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.engine_product_truth.v1"
    },
    "kind": {
     "const": "engine_product_truth"
    },
    "mcp_tools": {
     "type": "array",
     "minItems": 10,
     "contains": {
      "const": "deed_get_execution_quality"
     }
    },
    "safety_boundary": {
     "type": "object",
     "required": [
      "public_mcp_read_only",
      "private_key_custody",
      "auto_execution_enabled"
     ],
     "properties": {
      "public_mcp_read_only": {
       "const": true
      },
      "private_key_custody": {
       "const": false
      },
      "auto_execution_enabled": {
       "const": false
      }
     }
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "kind",
    "proof_systems",
    "safety_boundary"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.engine.proof.v1"
    },
    "kind": {
     "const": "engine_proof_contract"
    },
    "proof_systems": {
     "type": "array",
     "minItems": 6
    },
    "safety_boundary": {
     "type": "object",
     "required": [
      "read_only",
      "live_actions_exposed",
      "auto_execution_enabled"
     ],
     "properties": {
      "read_only": {
       "const": true
      },
      "live_actions_exposed": {
       "const": false
      },
      "auto_execution_enabled": {
       "const": false
      }
     }
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "kind",
    "status",
    "score_gate",
    "evidence_dimensions"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.engine.evidence_depth.v1"
    },
    "kind": {
     "const": "engine_evidence_depth_contract"
    },
    "status": {
     "const": "retained_samples_ready"
    },
    "score_gate": {
     "type": "object"
    },
    "evidence_dimensions": {
     "type": "array",
     "minItems": 6
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "kind",
    "health",
    "status",
    "observed",
    "native_dimension_routes"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.engine.retained_evidence_cadence.v1"
    },
    "kind": {
     "const": "engine_retained_evidence_cadence"
    },
    "health": {
     "enum": [
      "fresh",
      "due",
      "missing_evidence"
     ]
    },
    "status": {
     "enum": [
      "active",
      "blocked"
     ]
    },
    "observed": {
     "type": "object",
     "required": [
      "native_dimension_route_count",
      "native_dimension_routes_ready",
      "native_dimension_routes_fresh",
      "blockers"
     ],
     "properties": {
      "native_dimension_route_count": {
       "type": "integer",
       "minimum": 5
      },
      "native_dimension_routes_ready": {
       "type": "integer",
       "minimum": 5
      },
      "native_dimension_routes_fresh": {
       "type": "integer",
       "minimum": 0
      },
      "blockers": {
       "type": "array",
       "items": {
        "type": "string"
       }
      }
     }
    },
    "native_dimension_routes": {
     "type": "array",
     "minItems": 5
    }
   },
   "allOf": [
    {
     "if": {
      "properties": {
       "health": {
        "const": "fresh"
       }
      },
      "required": [
       "health"
      ]
     },
     "then": {
      "properties": {
       "status": {
        "const": "active"
       },
       "observed": {
        "properties": {
         "native_dimension_routes_fresh": {
          "type": "integer",
          "minimum": 5
         },
         "blockers": {
          "type": "array",
          "maxItems": 0
         }
        }
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "health": {
        "const": "due"
       }
      },
      "required": [
       "health"
      ]
     },
     "then": {
      "properties": {
       "status": {
        "const": "active"
       },
       "observed": {
        "properties": {
         "blockers": {
          "type": "array",
          "maxItems": 0
         }
        }
       }
      }
     }
    },
    {
     "if": {
      "properties": {
       "health": {
        "const": "missing_evidence"
       }
      },
      "required": [
       "health"
      ]
     },
     "then": {
      "properties": {
       "status": {
        "const": "blocked"
       },
       "observed": {
        "properties": {
         "blockers": {
          "type": "array",
          "minItems": 1
         }
        }
       }
      }
     }
    }
   ]
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "kind",
    "native_route_status",
    "can_execute_orders",
    "can_mutate_runtime",
    "sample_count"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.engine.native_dimension_readback.v1"
    },
    "kind": {
     "const": "engine_native_dimension_readback"
    },
    "native_route_status": {
     "const": "ready"
    },
    "can_execute_orders": {
     "const": false
    },
    "can_mutate_runtime": {
     "const": false
    },
    "sample_count": {
     "type": "integer",
     "minimum": 3
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "valid",
    "checks",
    "root_day",
    "deployment_id"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.verify_journal_root.v1"
    },
    "valid": {
     "type": "boolean"
    },
    "checks": {
     "type": "object",
     "required": [
      "root_hash_ok",
      "signature_ok",
      "anchor"
     ],
     "properties": {
      "root_hash_ok": {
       "type": "boolean"
      },
      "signature_ok": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "anchor": {
       "type": [
        "object",
        "null"
       ],
       "properties": {
        "provider": {
         "type": [
          "string",
          "null"
         ]
        },
        "status": {
         "type": [
          "string",
          "null"
         ]
        },
        "receipt_hash": {
         "type": [
          "string",
          "null"
         ]
        }
       }
      }
     }
    },
    "root_day": {
     "type": [
      "string",
      "null"
     ]
    },
    "deployment_id": {
     "type": [
      "string",
      "null"
     ]
    },
    "reason": {
     "type": "string"
    }
   }
  },
  {
   "type": "object",
   "required": [
    "schema_version",
    "valid",
    "checks",
    "mark",
    "card_id"
   ],
   "properties": {
    "schema_version": {
     "const": "deed.mcp.verify_proof_card.v1"
    },
    "valid": {
     "type": "boolean"
    },
    "checks": {
     "type": "object",
     "required": [
      "schema_ok",
      "self_issued_ok",
      "custody_invariant_ok",
      "not_expired",
      "revocation_shape_ok",
      "signature_ok"
     ],
     "properties": {
      "schema_ok": {
       "type": "boolean"
      },
      "self_issued_ok": {
       "type": "boolean"
      },
      "custody_invariant_ok": {
       "type": "boolean"
      },
      "not_expired": {
       "type": "boolean"
      },
      "revocation_shape_ok": {
       "type": "boolean"
      },
      "signature_ok": {
       "type": [
        "boolean",
        "null"
       ]
      }
     }
    },
    "mark": {
     "type": [
      "string",
      "null"
     ]
    },
    "card_id": {
     "type": [
      "string",
      "null"
     ]
    },
    "subject": {},
    "reason": {
     "type": "string"
    }
   }
  }
 ]
}
