{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/taxley/json-schema/taxley-tool-run-schema.json",
  "title": "ToolRun",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/taxley-tools-api-openapi.yml#/components/schemas/ToolRun",
  "type": "object",
  "required": [
    "tool",
    "input",
    "result",
    "page_url",
    "share_url",
    "calculated_by",
    "disclaimer"
  ],
  "properties": {
    "tool": {
      "type": "string"
    },
    "input": {
      "type": "object",
      "description": "The input as the tool read it (dates YYYY-MM-DD, money in pounds)."
    },
    "result": {
      "type": "object",
      "properties": {
        "answer": {
          "type": "string",
          "description": "A 40–60 word plain-English answer with the key figures."
        },
        "figures": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            }
          }
        },
        "data": {
          "type": "object",
          "description": "Machine-readable result: money in pounds (2 dp), dates YYYY-MM-DD."
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    },
    "page_url": {
      "type": "string",
      "format": "uri"
    },
    "share_url": {
      "type": "string",
      "format": "uri",
      "description": "A link to this result on taxley.co.uk."
    },
    "calculated_by": {
      "type": "string"
    },
    "disclaimer": {
      "type": "string"
    }
  }
}