{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://autoagentprotocol.org/v3.0/schemas/poppy-alternative.schema.json",
  "title": "PoppyAlternative",
  "description": "Another way to do a task: in an excluded task, or as the body of a 200 response to a feedback report. Spec 8.2 (Alternatives). Personal Agents skip reference types they don't recognize.",
  "type": "object",
  "anyOf": [
    {
      "required": [
        "instructions"
      ]
    },
    {
      "required": [
        "references"
      ]
    }
  ],
  "properties": {
    "instructions": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "references": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/reference"
      }
    }
  },
  "$defs": {
    "reference": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^[Hh][Tt][Tt][Pp][Ss]://[^/?#@\\s]+(?:[/?#][^\\s]*)?$"
        },
        "operation_id": {
          "type": "string",
          "minLength": 1
        },
        "tool": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "const": "openapi"
              }
            }
          },
          "then": {
            "required": [
              "url",
              "operation_id"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "mcp"
              }
            }
          },
          "then": {
            "required": [
              "url",
              "tool"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "web"
              }
            }
          },
          "then": {
            "required": [
              "url"
            ]
          }
        }
      ]
    }
  },
  "$comment": "Adapted from personal-agent-protocol/personal-agent-protocol at 86f0c8d8db3c95cf06d7e05370ec4bddf7d25bc7 (Apache-2.0). AAP changes schema identifiers, type titles and HTTPS URL validation; original fixtures and license are in tests/upstream/poppy."
}
