{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ucp.dev/2026-01-11/schemas/capability.json",
  "title": "UCP Capability",
  "description": "Schema for UCP capabilities and extensions. Extensions are capabilities with an 'extends' field. Uses reverse-domain naming for governance.",
  "$defs": {
    "base": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$",
          "description": "Stable capability identifier in reverse-domain notation (e.g., dev.ucp.shopping.checkout). Used in capability negotiation."
        },
        "version": {
          "$ref": "https://ucp.dev/2026-01-11/schemas/ucp.json#/$defs/version",
          "description": "Capability version in YYYY-MM-DD format."
        },
        "spec": {
          "type": "string",
          "format": "uri",
          "description": "URL to human-readable specification document."
        },
        "schema": {
          "type": "string",
          "format": "uri",
          "description": "URL to JSON Schema for this capability's payload."
        },
        "extends": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$",
          "description": "Parent capability this extends. Present for extensions, absent for root capabilities."
        },
        "config": {
          "type": "object",
          "description": "Capability-specific configuration (structure defined by each capability)."
        }
      }
    },
    "discovery": {
      "title": "Capability (Discovery)",
      "description": "Full capability declaration for discovery profiles. Includes spec/schema URLs for agent fetching.",
      "allOf": [
        {
          "$ref": "#/$defs/base"
        },
        {
          "required": [
            "name",
            "version",
            "spec",
            "schema"
          ]
        }
      ]
    },
    "response": {
      "title": "Capability (Response)",
      "description": "Capability reference in responses. Only name/version required to confirm active capabilities.",
      "allOf": [
        {
          "$ref": "#/$defs/base"
        },
        {
          "required": [
            "name",
            "version"
          ]
        }
      ]
    }
  }
}