{
  "openapi": "3.1.1",
  "info": {
    "title": "Best Months by Climate Normals API",
    "version": "1.0.0",
    "summary": "Typical weather per month from 1991–2020 normals, and the best months for an outdoor job.",
    "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://hearthclimatemonths.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Typical weather per month from 1991–2020 normals, and the best months for an outdoor job.",
        "description": "Finds the nearest weather station with official 1991–2020 climate normals — Deutscher Wetterdienst for Germany, NOAA for the United States — and rates every month for drying laundry, painting, mowing, barbecues or walks from its typical temperature and how often it rains.\n\nMethodology:\n- Germany: the nearest of 1,090 Deutscher Wetterdienst climate stations (within 40 km) from the bundled 1991–2020 multi-annual means — monthly mean temperature, precipitation and sunshine; precipitation and sunshine come from the same station or the nearest one within 15 km.\n- United States: the nearest NOAA NCEI station with 1991–2020 monthly normals, found with the NCEI search service in a box of ±0.4° (then ±1.2°) around the place; daily maximum and minimum temperature, precipitation and days with at least 0.10 inch of precipitation are converted to °C and mm. NCEI answers are cached for 30 days.\n- Each month gets a temperature fit from the mean temperature (0 below the activity’s lower limit, 1 in its ideal band, falling to 0 six degrees above the upper limit) and a dryness: 1 − wet days / days in month (NOAA), or for DWD stations (no wet-day count) the relative sunshine duration n/N — the sunshine normal per day divided by the maximum possible sunshine at mid-month (FAO-56 eq. 34) — or, without a sunshine normal, 1 − precipitation / 150 mm. Score = 100 × fit × dryness.\n- Bands (mean temperature, °C): drying 4–14 ideal to 30; painting 8–15 to 24; mowing 6–12 to 26; barbecue 10–18 to 27; walk −2–10 to 22. The best months are those within 10 points of the top score.\n\nNormals describe the average of 30 years, not next year’s weather. Ratings are a planning heuristic; for the actual day use the forecast tools.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "hearth_climate_months",
        "x-owner-app": "hearth",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HearthClimateMonthsInput"
              },
              "examples": {
                "example1": {
                  "summary": "Berlin: best months for drying laundry outside",
                  "value": {
                    "place": "52.47, 13.40",
                    "activity": "drying"
                  }
                },
                "example2": {
                  "summary": "Munich: best months to paint the house",
                  "value": {
                    "place": "48.14, 11.58",
                    "activity": "painting"
                  }
                },
                "example3": {
                  "summary": "Hamburg: barbecue months",
                  "value": {
                    "place": "53.55, 9.99",
                    "activity": "bbq"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HearthClimateMonthsResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "HearthClimateMonthsInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "place": {
            "title": "Place (latitude, longitude)",
            "description": "Decimal degrees such as “52.52, 13.40”, or degrees-minutes-seconds. Rounded to 0.01° (about 1 km) before the request.",
            "type": "string",
            "maxLength": 80,
            "default": "52.52, 13.40"
          },
          "activity": {
            "title": "Activity",
            "type": "string",
            "enum": [
              "drying",
              "painting",
              "mowing",
              "bbq",
              "walk"
            ],
            "default": "drying"
          }
        },
        "required": [
          "place"
        ]
      },
      "HearthClimateMonthsResult": {
        "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": [
              "place",
              "activity",
              "station",
              "months",
              "bestMonths",
              "attribution"
            ],
            "properties": {
              "place": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "lat",
                  "lon"
                ],
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                }
              },
              "activity": {
                "type": "string"
              },
              "station": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "source",
                  "id",
                  "name",
                  "lat",
                  "lon",
                  "distanceKm",
                  "notes"
                ],
                "properties": {
                  "source": {
                    "enum": [
                      "noaa",
                      "dwd"
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  },
                  "distanceKm": {
                    "type": "number"
                  },
                  "notes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "months": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "month",
                    "tMean",
                    "tMax",
                    "tMin",
                    "precipMm",
                    "wetDays",
                    "sunHours",
                    "score",
                    "temperatureFit",
                    "dryness"
                  ],
                  "properties": {
                    "month": {
                      "type": "integer"
                    },
                    "tMean": {
                      "type": "number"
                    },
                    "tMax": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "tMin": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "precipMm": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "wetDays": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "sunHours": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "score": {
                      "type": "integer"
                    },
                    "temperatureFit": {
                      "type": "number"
                    },
                    "dryness": {
                      "type": "number"
                    }
                  }
                }
              },
              "bestMonths": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "attribution": {
                "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"
              }
            }
          }
        }
      }
    }
  }
}