{
  "openapi": "3.1.1",
  "info": {
    "title": "Food Storage Guide API",
    "version": "1.0.0",
    "summary": "How long is food safe in the fridge or freezer? Dates from the official FoodSafety.gov chart.",
    "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://foodstorageguide.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "How long is food safe in the fridge or freezer? Dates from the official FoodSafety.gov chart.",
        "description": "Choose a food and the date you stored or opened it. The guide shows the refrigerator and freezer limits exactly as published in the FoodSafety.gov Cold Food Storage Chart, the resulting dates, and whether the food is fine, should be used soon, or should be discarded.\n\nMethodology:\n- Storage limits are copied verbatim from the FoodSafety.gov Cold Food Storage Chart (refrigerator at 40°F (4°C) or below, freezer at 0°F (-18°C) or below).\n- Text periods are converted to days with 1 week = 7 days, 1 month = 30 days, 1 year = 365 days; \"use immediately after thawing\" = 0 days.\n- Dates = date stored + lower limit (use-by earliest) and + upper limit (use-by latest).\n- Status (refrigerator/pantry): fine before the lower limit; use-soon from the lower limit up to the upper limit (for single values: on the last day); discard after the upper limit.\n- Freezer: the chart says freezer times are for quality only and food kept continuously at 0°F (-18°C) or below can be kept indefinitely, so the status after the upper limit is \"quality-past\", not \"discard\".\n- Items the chart marks \"Do not freeze\", \"Does not freeze well\" or \"Not recommended\" get status not-recommended.\n\nWhen in doubt, throw it out. Times assume correct storage temperatures throughout.",
        "tags": [
          "home-travel"
        ],
        "x-mcp-tool": "food_storage_guide",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FoodStorageGuideInput"
              },
              "examples": {
                "example1": {
                  "summary": "Leftover chicken cooked 3 days ago",
                  "value": {
                    "food": "leftover-meat-poultry",
                    "storage": "fridge",
                    "dateStored": "2026-10-09",
                    "today": "2026-10-12"
                  }
                },
                "example2": {
                  "summary": "Ground beef in the freezer since summer",
                  "value": {
                    "food": "ground-meat",
                    "storage": "freezer",
                    "dateStored": "2026-06-01",
                    "today": "2026-10-12"
                  }
                },
                "example3": {
                  "summary": "Opened deli meat after a week",
                  "value": {
                    "food": "luncheon-meat-opened",
                    "storage": "fridge",
                    "dateStored": "2026-10-05",
                    "today": "2026-10-12"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FoodStorageGuideResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "FoodStorageGuideInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "food": {
            "title": "Food",
            "type": "string",
            "enum": [
              "salads",
              "hot-dogs-opened",
              "hot-dogs-unopened",
              "luncheon-meat-opened",
              "luncheon-meat-unopened",
              "bacon",
              "sausage-raw",
              "sausage-cooked",
              "sausage-purchased-frozen",
              "ground-meat",
              "steaks",
              "chops",
              "roasts",
              "ham-fresh-uncooked",
              "ham-fresh-cooked",
              "ham-cured-uncooked",
              "ham-vacuum-sealed",
              "ham-cooked-whole",
              "ham-cooked-sliced",
              "country-ham-cooked",
              "canned-ham-keep-refrigerated",
              "canned-ham-shelf-stable-opened",
              "canned-ham-shelf-stable-unopened",
              "prosciutto",
              "poultry-whole",
              "poultry-pieces",
              "fatty-fish",
              "lean-fish-cod",
              "lean-fish-pollock",
              "crab-meat",
              "lobster",
              "live-crab-lobster",
              "live-clams",
              "shrimp",
              "shucked-clams",
              "squid",
              "eggs-in-shell",
              "egg-whites-yolks",
              "egg-frozen-in-shell",
              "hard-cooked-eggs",
              "egg-substitute-liquid-unopened",
              "egg-substitute-liquid-opened",
              "egg-substitute-frozen-unopened",
              "egg-substitute-frozen-opened",
              "egg-casseroles",
              "eggnog-commercial",
              "eggnog-homemade",
              "pie-pumpkin-pecan",
              "pie-custard-chiffon",
              "quiche",
              "soups-stews",
              "leftover-meat-poultry",
              "chicken-nuggets",
              "pizza"
            ],
            "default": "leftover-meat-poultry"
          },
          "storage": {
            "title": "Where is it stored?",
            "type": "string",
            "enum": [
              "fridge",
              "freezer",
              "pantry"
            ],
            "default": "fridge"
          },
          "dateStored": {
            "title": "Date stored / opened / cooked",
            "description": "Leave empty to use today.",
            "type": "string",
            "format": "date"
          },
          "today": {
            "title": "Today (optional)",
            "description": "Defaults to the current date.",
            "type": "string",
            "format": "date"
          }
        },
        "required": []
      },
      "FoodStorageGuideResult": {
        "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": [
              "food",
              "type",
              "storage",
              "dateStored",
              "today",
              "daysElapsed",
              "status",
              "methods"
            ],
            "properties": {
              "food": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "storage": {
                "type": "string",
                "enum": [
                  "fridge",
                  "freezer",
                  "pantry"
                ]
              },
              "dateStored": {
                "type": "string",
                "format": "date"
              },
              "today": {
                "type": "string",
                "format": "date"
              },
              "daysElapsed": {
                "type": "integer"
              },
              "status": {
                "type": "string",
                "enum": [
                  "fine",
                  "use-soon",
                  "discard",
                  "quality-past",
                  "not-recommended",
                  "see-note",
                  "no-data"
                ]
              },
              "methods": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "method",
                    "published",
                    "minDays",
                    "maxDays",
                    "useByEarliest",
                    "useByLatest",
                    "condition",
                    "orUseByDate",
                    "status",
                    "qualityOnly"
                  ],
                  "properties": {
                    "method": {
                      "type": "string",
                      "enum": [
                        "fridge",
                        "freezer",
                        "pantry"
                      ]
                    },
                    "published": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Verbatim chart text."
                    },
                    "minDays": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "maxDays": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "useByEarliest": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date",
                      "description": "Stored date + lower limit."
                    },
                    "useByLatest": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date",
                      "description": "Stored date + upper limit."
                    },
                    "condition": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "e.g. \"After baking\" – the period starts after that event."
                    },
                    "orUseByDate": {
                      "type": "boolean",
                      "description": "Chart says to follow the package \"use by\" date as alternative."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "fine",
                        "use-soon",
                        "discard",
                        "quality-past",
                        "not-recommended",
                        "see-note",
                        "no-data"
                      ]
                    },
                    "qualityOnly": {
                      "type": "boolean",
                      "description": "True for freezer times: the chart states they are for quality only."
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}