{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.nylorun.com/schemas/agent-folder/v1/tool.json",
  "title": "Nylorun agent folder: tools/<name>.json",
  "description": "An HTTP tool of an agent folder, tools/<name>.json: its file name is the tool's name",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "This file's JSON Schema, for editors; the compiler leaves it out of the manifest"
    },
    "description": {
      "type": "string",
      "description": "What the tool does, for the model"
    },
    "inputSchema": {
      "$ref": "#/$defs/JsonSchemaOrPath",
      "description": "The JSON Schema of the tool's input"
    },
    "outputSchema": {
      "$ref": "#/$defs/JsonSchemaOrPath",
      "description": "The JSON Schema of the tool's output"
    },
    "http": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ]
        },
        "credential": {
          "type": "string",
          "minLength": 1
        },
        "timeoutMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 2147483647
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": false,
      "description": "The request the tool makes; credential names the bearer slot it authenticates with"
    }
  },
  "required": [
    "inputSchema",
    "http"
  ],
  "additionalProperties": false,
  "$defs": {
    "JsonSchemaOrPath": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "\\.json$",
          "description": "The path of a JSON Schema file in the folder (./output.schema.json; /schemas/x.json from the uploaded folder's root), named *.schema.json or kept under schemas/"
        },
        {
          "type": "object",
          "description": "A JSON Schema (2020-12), inline"
        }
      ]
    }
  }
}
