{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://legalcontextprotocol.org/schema/legal-context.schema.json",
  "title": "Legal Context Protocol Discovery Document",
  "description": "Schema for /.well-known/legal-context.json — the discovery document defined by the Legal Context Protocol (LCP) v1.0.",
  "type": "object",
  "required": [
    "terms"
  ],
  "properties": {
    "terms": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "description": "Absolute HTTPS URL of the legal terms document. MUST return a standalone, downloadable file."
    },
    "termsFormat": {
      "type": "string",
      "description": "The format of the terms document, signalling whether the terms are machine-readable before fetching. Machine-readable, text-based values (markdown, json, plain) are recommended for agent-facing terms; page-layout formats (html, pdf) are not recommended for agent-facing terms.",
      "examples": [
        "markdown",
        "json",
        "plain",
        "html",
        "pdf"
      ]
    },
    "atrHash": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{64}$",
      "description": "SHA-256 hash of the Agentic Transaction Record (ATR) — the terms document itself. 0x-prefixed hex (66 characters); lowercase emission is recommended, and comparison is on the decoded bytes.",
      "minLength": 66,
      "maxLength": 66
    },
    "acceptanceRequired": {
      "type": "boolean",
      "default": false,
      "description": "If true, counterparties MUST explicitly accept terms before transacting."
    },
    "disputeResolution": {
      "type": "object",
      "description": "Dispute resolution process.",
      "properties": {
        "method": {
          "type": "string",
          "description": "The dispute resolution method (e.g., 'Dispute Resolution Service Rules')."
        },
        "jurisdiction": {
          "type": "string",
          "description": "Governing jurisdiction (e.g., 'New York, USA')."
        },
        "contact": {
          "type": "string",
          "description": "Contact for dispute filing (email or URL)."
        },
        "clauseId": {
          "type": "string",
          "pattern": "^sha256:0x[0-9a-fA-F]{64}$",
          "description": "Content-addressed identifier of the dispute resolution clause. Format: sha256:0x followed by 64 hex characters.",
          "minLength": 73,
          "maxLength": 73
        },
        "source": {
          "type": "string",
          "format": "uri",
          "description": "URL where the dispute resolution clause text can be retrieved."
        },
        "catalog": {
          "type": "string",
          "format": "uri",
          "description": "URL of the dispute resolution provider's service catalog for programmatic clause generation."
        }
      },
      "additionalProperties": true
    },
    "returns": {
      "type": "string",
      "format": "uri",
      "description": "URL of a returns or claims API/process."
    },
    "contact": {
      "type": "object",
      "description": "Contact information for the service.",
      "properties": {
        "legal": {
          "type": "string",
          "description": "Legal department contact."
        },
        "technical": {
          "type": "string",
          "description": "Technical support contact."
        }
      },
      "additionalProperties": true
    },
    "api": {
      "type": "string",
      "format": "uri",
      "description": "URL of a legal context API providing richer functionality (record management, verification, dispute filing)."
    }
  },
  "additionalProperties": true
}
