{
  "openapi": "3.1.1",
  "info": {
    "title": "Skyfold Local Eclipse Circumstances API",
    "version": "1.0.0",
    "summary": "Solar and lunar eclipses 2020–2040 as seen from your place, with contact times.",
    "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://skyfoldeclipselocal.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Solar and lunar eclipses 2020–2040 as seen from your place, with contact times.",
        "description": "For a place, lists every solar and lunar eclipse from 2020 to 2040 with what you will see: partial, annular or total, contact times C1–C4, magnitude, obscuration, duration and the Sun or Moon altitude, computed from NASA Besselian elements.\n\nMethodology:\n- Solar eclipses: NASA/Espenak polynomial Besselian elements (VSOP87/ELP2000-85) with the classical local-circumstances iteration (Explanatory Supplement 1961; Meeus, Elements of Solar Eclipses): maximum where the shadow axis passes closest, contacts where the distance equals the penumbral (C1, C4) or umbral (C2, C3) radius.\n- Magnitude = (L1 − m)/(L1 + L2); obscuration is the covered fraction of the solar disc area from circle overlap.\n- Lunar eclipses: contact times from Espenak’s Five Millennium Catalog (greatest eclipse ± half the phase durations) and the Moon’s altitude from the Skyfold ephemeris.\n- Times are converted from TD to UT with the ΔT used by NASA for each eclipse.\n\nContact times agree with NASA’s published city tables to within a minute; mountains, the lunar limb profile and local weather are not included. Never look at the Sun without certified eclipse glasses, except during totality.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "skyfold_eclipse_local",
        "x-owner-app": "skyfold",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkyfoldEclipseLocalInput"
              },
              "examples": {
                "example1": {
                  "summary": "Burgos, Spain: the 2026–2028 eclipses",
                  "value": {
                    "location": "42.3439, -3.6969",
                    "elevation": 860,
                    "timeZone": "Europe/Madrid",
                    "fromYear": 2026,
                    "toYear": 2028,
                    "kind": "both",
                    "visibleOnly": true
                  }
                },
                "example2": {
                  "summary": "Dallas: the total eclipse of 8 April 2024",
                  "value": {
                    "location": "32.7767, -96.797",
                    "elevation": 140,
                    "timeZone": "America/Chicago",
                    "fromYear": 2024,
                    "toYear": 2024,
                    "kind": "solar",
                    "visibleOnly": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkyfoldEclipseLocalResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "SkyfoldEclipseLocalInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "location": {
            "title": "Location (latitude, longitude)",
            "description": "Decimal degrees such as 52.09, 5.12 (north and east positive), or DMS, UTM, MGRS, Maidenhead or a plus code.",
            "type": "string",
            "maxLength": 80,
            "default": "42.3439, -3.6969"
          },
          "elevation": {
            "title": "Elevation above sea level",
            "type": "number",
            "minimum": -500,
            "maximum": 9000,
            "default": 0,
            "x-unit": "m"
          },
          "timeZone": {
            "title": "Time zone",
            "description": "IANA name such as Europe/Berlin or America/New_York, or a fixed offset such as UTC+2.",
            "type": "string",
            "maxLength": 64,
            "default": "Europe/Madrid"
          },
          "fromYear": {
            "title": "From year",
            "type": "integer",
            "minimum": 2020,
            "maximum": 2040,
            "default": 2026
          },
          "toYear": {
            "title": "To year",
            "type": "integer",
            "minimum": 2020,
            "maximum": 2040,
            "default": 2028
          },
          "kind": {
            "title": "Eclipses",
            "type": "string",
            "enum": [
              "both",
              "solar",
              "lunar"
            ],
            "default": "both"
          },
          "visibleOnly": {
            "title": "Only eclipses visible from this place",
            "type": "boolean",
            "default": true
          }
        },
        "required": []
      },
      "SkyfoldEclipseLocalResult": {
        "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"
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}