{
  "openapi": "3.1.1",
  "info": {
    "title": "Everyday Size Compare API",
    "version": "1.0.0",
    "summary": "Overlay measured objects at the same scale and export a dimensioned sketch.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://hearthsizecompare.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Overlay measured objects at the same scale and export a dimensioned sketch.",
        "description": "Compare measured objects in front, side or top view, with unit conversion, a shared scale, overlays and relative dimensions.\n\nMethodology:\n- Input dimensions are converted to millimetres. Front, side and top rectangles share a common scale and baseline; ratios compare against the first object.\n- Volumes use rectangular bounding boxes. This tool does not assess three-dimensional transport paths or complex fit.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "hearth_size_compare",
        "x-owner-app": "hearth",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HearthSizeCompareInput"
              },
              "examples": {
                "example1": {
                  "summary": "Try an example",
                  "value": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HearthSizeCompareResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "HearthSizeCompareInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "objects": {
            "title": "Objects",
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "title": "Object",
                  "type": "string",
                  "maxLength": 100000
                },
                "width": {
                  "title": "Width",
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                },
                "height": {
                  "title": "Height",
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                },
                "depth": {
                  "title": "Depth",
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                }
              },
              "required": [
                "name",
                "width",
                "height",
                "depth"
              ]
            },
            "default": [
              {
                "name": "Old monitor",
                "width": 540,
                "height": 330,
                "depth": 60
              },
              {
                "name": "New monitor",
                "width": 710,
                "height": 420,
                "depth": 70
              }
            ]
          },
          "view": {
            "title": "View",
            "type": "string",
            "enum": [
              "front",
              "side",
              "top"
            ],
            "default": "front"
          },
          "layout": {
            "title": "Layout",
            "type": "string",
            "enum": [
              "overlay",
              "beside"
            ],
            "default": "overlay"
          },
          "unit": {
            "title": "Input unit",
            "type": "string",
            "enum": [
              "mm",
              "cm",
              "in"
            ],
            "default": "mm"
          }
        },
        "required": []
      },
      "HearthSizeCompareResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "objects",
              "view",
              "layout",
              "unit",
              "svg"
            ],
            "properties": {
              "objects": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "width",
                    "height",
                    "depth",
                    "volumeLitres",
                    "widthRatio",
                    "heightRatio",
                    "depthRatio"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "width": {
                      "type": "number"
                    },
                    "height": {
                      "type": "number"
                    },
                    "depth": {
                      "type": "number"
                    },
                    "volumeLitres": {
                      "type": "number"
                    },
                    "widthRatio": {
                      "type": "number"
                    },
                    "heightRatio": {
                      "type": "number"
                    },
                    "depthRatio": {
                      "type": "number"
                    }
                  }
                }
              },
              "view": {
                "type": "string"
              },
              "layout": {
                "type": "string"
              },
              "unit": {
                "type": "string"
              },
              "svg": {
                "type": "string"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}