{
  "openapi": "3.1.1",
  "info": {
    "title": "Pet Age in Human Years API",
    "version": "1.0.0",
    "summary": "Your dog’s or cat’s age in human years from published charts and the DNA-based dog formula.",
    "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://hearthpetage.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Your dog’s or cat’s age in human years from published charts and the DNA-based dog formula.",
        "description": "Converts a dog’s age with the AVMA chart for its size group and the DNA-methylation formula of Wang et al. (2020), and a cat’s age with the International Cat Care chart and life stage. Every number is an estimate that helps you think about life stages, not a medical age.\n\nMethodology:\n- Dogs, size chart: the AVMA “dog years” chart for ages 1–16 by adult weight (small ≤ 20 lb ≈ 9 kg, medium 21–50 lb, large 51–90 lb, giant \u003e 90 lb), straight-line between whole years and continued with its last yearly step beyond 16. Some versions of the chart put the giant limit at 100 lb.\n- Dogs, DNA formula: human age = 16 × ln(dog age) + 31 (Wang et al. 2020, from DNA methylation of 104 Labrador retrievers). Shown from one year on; for young puppies it gives implausible values.\n- Cats: the International Cat Care chart (1 month ≈ 1 year, 6 months ≈ 10, 1 year ≈ 15, 2 years ≈ 24, then 4 human years per cat year up to 25 years ≈ 116), interpolated in a straight line, and its life stages kitten, junior, adult, mature, senior, super senior.\n\nHuman-year ages are estimates for thinking about life stages. Breed, size and health change how a pet ages — ask your vet about check-ups for its life stage.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "hearth_pet_age",
        "x-owner-app": "hearth",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HearthPetAgeInput"
              },
              "examples": {
                "example1": {
                  "summary": "Five-year-old 20 kg dog",
                  "value": {
                    "species": "dog",
                    "ageYears": 5,
                    "size": "auto",
                    "weightKg": 20
                  }
                },
                "example2": {
                  "summary": "Ten-year-old giant dog",
                  "value": {
                    "species": "dog",
                    "ageYears": 10,
                    "size": "giant",
                    "weightKg": 60
                  }
                },
                "example3": {
                  "summary": "Cat aged one and a half",
                  "value": {
                    "species": "cat",
                    "ageYears": 1.5,
                    "size": "auto",
                    "weightKg": 4
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HearthPetAgeResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "HearthPetAgeInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "species": {
            "title": "Animal",
            "type": "string",
            "enum": [
              "dog",
              "cat"
            ],
            "default": "dog"
          },
          "ageYears": {
            "title": "Age (years, decimals allowed)",
            "type": "number",
            "minimum": 0,
            "maximum": 40,
            "default": 5
          },
          "size": {
            "title": "Dog size group",
            "type": "string",
            "enum": [
              "auto",
              "small",
              "medium",
              "large",
              "giant"
            ],
            "default": "auto"
          },
          "weightKg": {
            "title": "Adult weight (kg, for “from the adult weight”)",
            "type": "number",
            "minimum": 0,
            "maximum": 120,
            "default": 20
          }
        },
        "required": []
      },
      "HearthPetAgeResult": {
        "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": [
              "species",
              "ageYears",
              "size",
              "chartAge",
              "chartExtrapolated",
              "wangAge",
              "catStage",
              "notes"
            ],
            "properties": {
              "species": {
                "enum": [
                  "dog",
                  "cat"
                ]
              },
              "ageYears": {
                "type": "number"
              },
              "size": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "chartAge": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "chartExtrapolated": {
                "type": "boolean"
              },
              "wangAge": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "catStage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": "array",
                "items": {
                  "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"
              }
            }
          }
        }
      }
    }
  }
}