{
  "openapi": "3.1.1",
  "info": {
    "title": "Garden Weather Tasks API",
    "version": "1.0.0",
    "summary": "Frost warnings, watering you can skip after rain, and litres per bed from the MET Norway forecast.",
    "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://greenplotweathertasks.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Frost warnings, watering you can skip after rain, and litres per bed from the MET Norway forecast.",
        "description": "Reads the MET Norway forecast for your garden and turns it into garden tasks for the coming days: frost and cold-night warnings for tender plants in the ground, days when rain makes watering unnecessary, hot days, and how many litres each bed needs from FAO-56 crop water use — with the best days to water.\n\nMethodology:\n- Fetches the MET Norway Locationforecast 2.0 for the place (rounded to 0.01°) through Hearth’s cached client, which honours MET’s Expires and If-Modified-Since rules, and groups the hours into complete local days (at least 20 forecast hours).\n- Frost: a day with a minimum of 1 °C or lower while a tender or half-hardy plant is in the ground (planted or sown before that day) → protect it with fleece or bring pots in; ground frost often comes at 1–3 °C air temperature. Cold night: a minimum of 4 °C or lower while tender plants (tomatoes, beans, courgettes …) are out. Hot day: a maximum of 30 °C or more.\n- Skip watering: a day with 5 mm of rain or more, or the day after one; established beds need no extra water then.\n- Litres per bed: Hearth’s FAO-56 watering need — Penman–Monteith reference evapotranspiration from the forecast, times the crop coefficient of each plant and its growth stage, minus the rain that reaches the roots (80 % of daily rain over 2 mm) — with one soaking per about 12 mm of need, placed on evenly spread days that are not skip days.\n\nForecasts change; frost in hollows and on clear, still nights can come earlier than forecast for the area. Containers and greenhouses need more water.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "greenplot_weather_tasks",
        "x-owner-app": "greenplot",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GreenplotWeatherTasksInput"
              },
              "examples": {
                "example1": {
                  "summary": "Berlin: tomatoes, basil and strawberries",
                  "value": {
                    "place": "52.47, 13.40",
                    "timeZone": "Europe/Berlin",
                    "days": 7,
                    "plantings": [
                      {
                        "bed": "Raised bed 1",
                        "plant": "tomato",
                        "areaM2": 0.72
                      },
                      {
                        "bed": "Raised bed 1",
                        "plant": "basil",
                        "areaM2": 0.18
                      },
                      {
                        "bed": "Raised bed 2",
                        "plant": "strawberry",
                        "areaM2": 1.08
                      }
                    ]
                  }
                },
                "example2": {
                  "summary": "Oslo allotment with young courgettes",
                  "value": {
                    "place": "59.91, 10.75",
                    "timeZone": "Europe/Oslo",
                    "days": 5,
                    "plantings": [
                      {
                        "bed": "Plot",
                        "plant": "zucchini",
                        "areaM2": 2
                      },
                      {
                        "bed": "Plot",
                        "plant": "potato",
                        "areaM2": 6
                      },
                      {
                        "bed": "Fruit",
                        "plant": "blackcurrant",
                        "areaM2": 3
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GreenplotWeatherTasksResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "GreenplotWeatherTasksInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "place": {
            "title": "Place (latitude, longitude)",
            "description": "Decimal degrees such as “52.47, 13.40”. Rounded to 0.01° (about 1 km).",
            "type": "string",
            "maxLength": 80,
            "default": "52.47, 13.40"
          },
          "timeZone": {
            "title": "Time zone of the place",
            "type": "string",
            "maxLength": 40,
            "default": "Europe/Berlin"
          },
          "days": {
            "title": "Days ahead",
            "type": "integer",
            "minimum": 1,
            "maximum": 9,
            "default": 7
          },
          "plantings": {
            "title": "Plantings",
            "type": "array",
            "minItems": 1,
            "maxItems": 120,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "bed": {
                  "title": "Bed",
                  "type": "string",
                  "maxLength": 40
                },
                "plant": {
                  "title": "Plant",
                  "type": "string",
                  "enum": [
                    "tomato",
                    "pepper",
                    "eggplant",
                    "potato",
                    "cucumber",
                    "zucchini",
                    "squash",
                    "melon",
                    "sweetcorn",
                    "bush-bean",
                    "pole-bean",
                    "pea",
                    "broad-bean",
                    "lettuce",
                    "spinach",
                    "chard",
                    "beet",
                    "carrot",
                    "parsnip",
                    "radish",
                    "turnip",
                    "onion",
                    "spring-onion",
                    "garlic",
                    "leek",
                    "cabbage",
                    "broccoli",
                    "cauliflower",
                    "kale",
                    "brussels-sprouts",
                    "kohlrabi",
                    "pak-choi",
                    "rocket",
                    "celery",
                    "fennel",
                    "parsley",
                    "basil",
                    "dill",
                    "coriander",
                    "chives",
                    "asparagus",
                    "rhubarb",
                    "artichoke",
                    "jerusalem-artichoke",
                    "sweet-potato",
                    "okra",
                    "celeriac",
                    "swede",
                    "endive",
                    "chicory",
                    "mizuna",
                    "corn-salad",
                    "shallot",
                    "chilli",
                    "mangetout",
                    "chinese-cabbage",
                    "horseradish",
                    "cress",
                    "mustard-greens",
                    "soybean",
                    "tomatillo",
                    "watermelon",
                    "rosemary",
                    "thyme",
                    "sage",
                    "oregano",
                    "mint",
                    "lavender",
                    "tarragon",
                    "lemon-balm",
                    "lovage",
                    "sorrel",
                    "bay",
                    "marjoram",
                    "chamomile",
                    "borage",
                    "chervil",
                    "summer-savory",
                    "strawberry",
                    "raspberry",
                    "autumn-raspberry",
                    "blackberry",
                    "blueberry",
                    "gooseberry",
                    "redcurrant",
                    "blackcurrant",
                    "apple",
                    "pear",
                    "plum",
                    "cherry",
                    "peach",
                    "apricot",
                    "quince",
                    "fig",
                    "grape",
                    "kiwi",
                    "physalis",
                    "sunflower",
                    "french-marigold",
                    "calendula",
                    "nasturtium",
                    "sweet-pea",
                    "cosmos",
                    "zinnia",
                    "cornflower",
                    "poppy",
                    "nigella",
                    "phacelia",
                    "crimson-clover",
                    "dahlia",
                    "tulip",
                    "daffodil",
                    "snapdragon",
                    "alyssum",
                    "larkspur",
                    "gladiolus",
                    "echinacea",
                    "rudbeckia",
                    "lupin",
                    "hollyhock",
                    "verbena",
                    "sweet-william"
                  ],
                  "default": "tomato"
                },
                "areaM2": {
                  "title": "Area (m²)",
                  "type": "number",
                  "minimum": 0.01,
                  "maximum": 500,
                  "default": 1
                },
                "planted": {
                  "title": "Planted or sown on (optional)",
                  "type": "string",
                  "format": "date"
                }
              },
              "required": [
                "bed"
              ]
            },
            "default": [
              {
                "bed": "Raised bed 1",
                "plant": "tomato",
                "areaM2": 0.72
              },
              {
                "bed": "Raised bed 1",
                "plant": "basil",
                "areaM2": 0.18
              },
              {
                "bed": "Raised bed 2",
                "plant": "strawberry",
                "areaM2": 1.08
              }
            ]
          }
        },
        "required": [
          "place"
        ]
      },
      "GreenplotWeatherTasksResult": {
        "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",
              "timeZone",
              "forecastUpdated",
              "days",
              "plantings",
              "beds",
              "totalLitres",
              "et0Total",
              "rainTotal",
              "warnings",
              "skipWatering",
              "attribution"
            ],
            "properties": {
              "place": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "lat",
                  "lon"
                ],
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                }
              },
              "timeZone": {
                "type": "string"
              },
              "forecastUpdated": {
                "type": "string"
              },
              "days": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "date",
                    "et0",
                    "rain",
                    "effectiveRain",
                    "tmax",
                    "tmin",
                    "cloud",
                    "wind"
                  ],
                  "properties": {
                    "et0": {
                      "type": "number"
                    },
                    "rain": {
                      "type": "number"
                    },
                    "effectiveRain": {
                      "type": "number"
                    },
                    "tmax": {
                      "type": "number"
                    },
                    "tmin": {
                      "type": "number"
                    },
                    "cloud": {
                      "type": "number"
                    },
                    "wind": {
                      "type": "number"
                    },
                    "date": {
                      "type": "string"
                    }
                  }
                }
              },
              "plantings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "bed",
                    "crop",
                    "areaM2",
                    "planted",
                    "stage",
                    "etcMm",
                    "rainMm",
                    "needMm",
                    "litres"
                  ],
                  "properties": {
                    "bed": {
                      "type": "string"
                    },
                    "crop": {
                      "type": "string"
                    },
                    "areaM2": {
                      "type": "number"
                    },
                    "planted": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stage": {
                      "type": "string"
                    },
                    "etcMm": {
                      "type": "number"
                    },
                    "rainMm": {
                      "type": "number"
                    },
                    "needMm": {
                      "type": "number"
                    },
                    "litres": {
                      "type": "number"
                    }
                  }
                }
              },
              "beds": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "bed",
                    "areaM2",
                    "litres",
                    "needMm",
                    "waterings",
                    "litresPerWatering",
                    "when"
                  ],
                  "properties": {
                    "bed": {
                      "type": "string"
                    },
                    "areaM2": {
                      "type": "number"
                    },
                    "litres": {
                      "type": "number"
                    },
                    "needMm": {
                      "type": "number"
                    },
                    "waterings": {
                      "type": "integer"
                    },
                    "litresPerWatering": {
                      "type": "number"
                    },
                    "when": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "totalLitres": {
                "type": "number"
              },
              "et0Total": {
                "type": "number"
              },
              "rainTotal": {
                "type": "number"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "code",
                    "date",
                    "plants",
                    "beds"
                  ],
                  "properties": {
                    "code": {
                      "enum": [
                        "frost",
                        "cold",
                        "heat"
                      ]
                    },
                    "date": {
                      "type": "string"
                    },
                    "tmin": {
                      "type": "number"
                    },
                    "tmax": {
                      "type": "number"
                    },
                    "plants": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "beds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "skipWatering": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "date",
                    "rain",
                    "rainBefore"
                  ],
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "rain": {
                      "type": "number"
                    },
                    "rainBefore": {
                      "type": "number"
                    }
                  }
                }
              },
              "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"
              }
            }
          }
        }
      }
    }
  }
}