{
  "openapi": "3.1.1",
  "info": {
    "title": "Skyfold Planet and Moon Positions API",
    "version": "1.0.0",
    "summary": "Where the Sun, Moon and planets are, and when they rise and set, for any place and time.",
    "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://skyfoldplanetpositions.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Where the Sun, Moon and planets are, and when they rise and set, for any place and time.",
        "description": "Apparent right ascension, declination, azimuth, altitude, distance, magnitude and phase of the Sun, Moon and seven planets for a place and local time, with rise, transit and set times, twilight and the next Moon phases.\n\nMethodology:\n- Sun and planets: truncated VSOP87D series with light-time iteration, conversion to FK5, nutation (IAU 1980, low-precision terms) and annual aberration (Meeus chapters 25, 32, 33).\n- Moon: the truncated ELP-2000/82 series of Meeus chapter 47 plus nutation; topocentric parallax for altitude and rise/set.\n- Altitudes include standard refraction (Sæmundsson, 10 °C, 1010 hPa). Rise and set use the USNO convention: upper limb on an ideal sea-level horizon with 34′ refraction.\n- Time scales: UTC ≈ UT1; ΔT from observed values 2000–2026 and the Espenak–Meeus polynomials outside.\n\nAccuracy is about an arcsecond or a few arcseconds for the Sun and planets and about 10″ for the Moon against JPL Horizons; rise and set times agree with the U.S. Naval Observatory to the minute in the tests. Local horizon obstructions, weather and unusual refraction are not modelled.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "skyfold_planet_positions",
        "x-owner-app": "skyfold",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkyfoldPlanetPositionsInput"
              },
              "examples": {
                "example1": {
                  "summary": "Utrecht on a November evening",
                  "value": {
                    "location": "52.0907, 5.1214",
                    "elevation": 5,
                    "timeZone": "Europe/Amsterdam",
                    "date": "2026-11-07",
                    "time": "22:00"
                  }
                },
                "example2": {
                  "summary": "Sydney at midnight, southern summer",
                  "value": {
                    "location": "-33.8688, 151.2093",
                    "elevation": 58,
                    "timeZone": "Australia/Sydney",
                    "date": "2027-01-15",
                    "time": "00:00"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkyfoldPlanetPositionsResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "SkyfoldPlanetPositionsInput": {
        "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": "52.0907, 5.1214"
          },
          "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/Amsterdam"
          },
          "date": {
            "title": "Local date",
            "type": "string",
            "format": "date",
            "default": "2026-11-07"
          },
          "time": {
            "title": "Local time",
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
            "default": "22:00"
          }
        },
        "required": []
      },
      "SkyfoldPlanetPositionsResult": {
        "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"
              }
            }
          }
        }
      }
    }
  }
}