{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "listof.tools tool definition",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "name",
    "provider",
    "description",
    "documentation",
    "endpoint",
    "method",
    "output",
    "parameters",
    "example"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "provider": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "category": {
      "type": "string",
      "maxLength": 40
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "documentation": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "maxLength": 500
    },
    "endpoint": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "maxLength": 500
    },
    "method": {
      "enum": [
        "GET",
        "POST"
      ]
    },
    "output": {
      "enum": [
        "json",
        "text",
        "image"
      ]
    },
    "parameters": {
      "type": "array",
      "maxItems": 8,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
            "maxLength": 40
          },
          "label": {
            "type": "string",
            "maxLength": 80
          },
          "type": {
            "enum": [
              "text",
              "enum",
              "url",
              "url-list"
            ],
            "default": "text"
          },
          "required": {
            "type": "boolean",
            "default": true
          },
          "maxLength": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2048,
            "description": "Per-item length for url-list (up to 2048); other types allow up to 500."
          },
          "minItems": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "maxItems": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "example": {
            "type": "string",
            "maxLength": 2048
          },
          "choices": {
            "type": "array",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "example": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            }
          }
        ]
      }
    },
    "fixedQuery": {
      "type": "object",
      "maxProperties": 8,
      "additionalProperties": {
        "type": "string",
        "maxLength": 512
      }
    },
    "fixedHeaders": {
      "type": "object",
      "maxProperties": 8,
      "additionalProperties": {
        "type": "string",
        "maxLength": 512
      }
    },
    "bodyTemplate": {
      "type": "object",
      "description": "For read-only POST requests. Replace \"$inputName\" values with the matching input."
    },
    "queryTemplate": {
      "type": "object",
      "maxProperties": 8,
      "description": "For GET queries: {{inputName}} becomes a quoted JSON/SPARQL string literal, never raw query code. References must name required inputs.",
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4000
      }
    },
    "check": {
      "description": "Required for submissions: expected JSON field/type, text value or PNG check.",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "path",
            "type"
          ],
          "properties": {
            "path": {
              "type": "string",
              "maxLength": 160
            },
            "type": {
              "enum": [
                "object",
                "array",
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "equals": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "contains"
          ],
          "properties": {
            "contains": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "equals"
          ],
          "properties": {
            "equals": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        },
        {
          "type": "object",
          "maxProperties": 0
        }
      ]
    }
  }
}