{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://hai.ai/schemas/components/tool/v1/tool.schema.json",
  "title": "Tool",
  "TODO": "file attachments",
  "description": "OpenAI function calling definitions https://platform.openai.com/docs/assistants/tools/function-calling/quickstart. Has an additional field of URL",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "description": " endpoint of the tool",
        "format": "uri"
      },
      "responseRequired": {
        "type": "boolean",
        "description": "Will the tool require waiting for a response. Default true."
      },
      "reseponseTimeout": {
        "type": "integer",
        "description": "How long to wait for a response."
      },
      "retryTimes": {
        "type": "integer",
        "description": "How many times to retry on failure."
      },
      "pricingDescription": {
        "type": "integer",
        "description": "Is the function expensive, not expensive?"
      },
      "function": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the function which will be used to call it. "
          },
          "description": {
            "type": "string",
            "description": "A description of what the function does."
          },
          "descriptionDontUse": {
            "type": "string",
            "description": "A description  when the function should not be used."
          },
          "descriptionDoUse": {
            "type": "string",
            "description": "A description for when the function should be used"
          },
          "parameters": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "object"
                ]
              },
              "properties": {
                "type": "object",
                "patternProperties": {
                  "^.*$": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "string",
                          "integer",
                          "boolean"
                        ]
                      },
                      "enum": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "description": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type"
                    ]
                  }
                }
              },
              "required": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "properties",
              "required"
            ]
          }
        },
        "required": [
          "name",
          "description",
          "parameters"
        ]
      }
    },
    "required": [
      "function",
      "url"
    ]
  },
  "additionalProperties": false
}
