{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://app.tamarind.bio/tamarind-tool.schema.json",
  "title": "Tamarind Custom Tool Config",
  "description": "Declarative config for a Tamarind custom tool. Mirrors the fields editable in the Config tab of the custom-tools UI.",
  "type": "object",
  "properties": {
    "displayName": {
      "type": "string",
      "minLength": 1,
      "description": "Human-readable tool name shown in the UI."
    },
    "description": {
      "type": "string",
      "description": "One-liner shown on the tool card."
    },
    "functions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Long description bullets — one string per bullet."
    },
    "gpuType": {
      "type": "string",
      "enum": [
        "None",
        "T4",
        "L4",
        "L40S",
        "A10",
        "A100"
      ],
      "description": "GPU type for the tool container. \"None\" for CPU-only."
    },
    "memory": {
      "type": "string",
      "description": "Memory allocation (e.g., \"12Gi\", \"32Gi\")."
    },
    "cpu": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8,
      "description": "Number of CPU cores."
    },
    "envVars": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "propertyNames": {
        "pattern": "^[A-Z][A-Z0-9_]*$"
      },
      "description": "Environment variables passed to the container at runtime."
    },
    "inputs": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "file"
              },
              "extension": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9]+$"
                },
                "minItems": 1
              }
            },
            "required": [
              "name",
              "type",
              "extension"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "pdb"
              },
              "extension": {
                "type": "array",
                "items": {
                  "type": "string",
                  "const": "pdb"
                }
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "sdf"
              },
              "extension": {
                "type": "array",
                "items": {
                  "type": "string",
                  "const": "sdf"
                }
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "sequence"
              },
              "default": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "smiles"
              },
              "default": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "text"
              },
              "default": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "number"
              },
              "default": {
                "type": "number"
              },
              "lowerBound": {
                "type": "number"
              },
              "upperBound": {
                "type": "number"
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "boolean"
              },
              "default": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
              },
              "displayName": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "descr": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "dropdown"
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1
              },
              "default": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "type",
              "options"
            ],
            "additionalProperties": false
          }
        ]
      },
      "description": "User-facing input fields. Matches the Inputs section of the Config tab."
    }
  },
  "required": [
    "displayName",
    "inputs"
  ],
  "additionalProperties": false
}
