{
  "openapi": "3.1.0",
  "info": {
    "title": "SnowLive Public Agent & Mountain Data API",
    "version": "1.1.0",
    "summary": "Public read-only API, NLWeb /v1/ask search, and Streamable HTTP MCP Server for 102 global 3D ski resorts.",
    "description": "SnowLive (Powered by Alpine Intelligence) provides interactive 3D alpine terrain, live Open-Meteo snow & weather forecasts, official avalanche bulletins (avalanche.org, SLF Switzerland, EAWS Tirol/Südtirol/Trentino), live mountain highway traffic & chain laws (Caltrans, DriveBC, Bison Futé, Open Data Hub Südtirol), OpenStreetMap piste & lift topology, 253 live mountain webcams, and daily refreshed resort activities across 102 global ski resorts.\n\n## Versioning & Deprecation Policy (RFC 8594)\nAll API and MCP endpoints accept an optional `X-API-Version` request header (default `1.0`) and emit `X-API-Version: 1.0` on responses. Versioned routes (such as `/v1/ask`) remain backward-compatible within a major version. When an endpoint or schema field is scheduled for removal, SnowLive emits standard RFC 8594 `Deprecation` and `Sunset` HTTP response headers at least 90 days prior to retirement, along with a `Link` header (`rel=\"deprecation\"`) pointing to migration docs at `https://snowlive.io/developers/`.\n\n## Rate Limits\nPublic read-only endpoints emit both IETF draft `RateLimit` / `RateLimit-Policy` headers (`120;w=60`) and legacy `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers.",
    "contact": {
      "name": "SnowLive Support",
      "email": "support@snowlive.io",
      "url": "https://snowlive.io/contact/"
    }
  },
  "servers": [
    {
      "url": "https://snowlive.io",
      "description": "SnowLive Cloudflare Pages Production Edge"
    }
  ],
  "tags": [
    {
      "name": "NLWeb Search",
      "description": "NLWeb v0.55 natural-language search endpoints (/v1/ask and /ask) with cursor pagination and SSE streaming"
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol (Streamable HTTP JSON-RPC 2.0) endpoints (/mcp and /api/mcp) for AI agents"
    },
    {
      "name": "Live Conditions",
      "description": "Live avalanche bulletins, mountain highway traffic & chain laws, and edge geo-context"
    },
    {
      "name": "Topology & Guides",
      "description": "OpenStreetMap ski pistes, lifts, peaks, catalog index, and daily resort events"
    }
  ],
  "paths": {
    "/v1/ask": {
      "get": {
        "tags": ["NLWeb Search"],
        "operationId": "askV1Get",
        "summary": "Natural-language search over SnowLive resorts and docs (v1 GET)",
        "description": "NLWeb v0.55 versioned natural-language search endpoint with cursor pagination (`cursor`, `next_cursor`, `has_more`) and optional Server-Sent Events streaming (`streaming=true`).",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "Natural-language search query (e.g. 'deep powder resorts in Switzerland' or 'Val Thorens webcams').",
            "schema": { "type": "string", "minLength": 1, "example": "high altitude ski resorts in France" }
          },
          { "$ref": "#/components/parameters/Cursor" },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results per page (default 10, max 25).",
            "schema": { "type": "integer", "minimum": 1, "maximum": 25, "default": 10 }
          },
          {
            "name": "streaming",
            "in": "query",
            "required": false,
            "description": "Set to true to receive a text/event-stream SSE response.",
            "schema": { "type": "boolean", "default": false }
          }
        ],
        "responses": {
          "200": {
            "description": "NLWeb v0.55 ranked search results with cursor pagination metadata",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimitPolicy" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AskResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      },
      "post": {
        "tags": ["NLWeb Search"],
        "operationId": "askV1Post",
        "summary": "Natural-language search over SnowLive resorts and docs (v1 POST)",
        "description": "NLWeb v0.55 versioned POST search endpoint supporting structured query objects, cursor pagination, and optional SSE streaming.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          { "$ref": "#/components/parameters/IdempotencyKey" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/AskRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "NLWeb v0.55 ranked search results with cursor pagination metadata",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimitPolicy" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AskResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/ask": {
      "get": {
        "tags": ["NLWeb Search"],
        "operationId": "askGet",
        "summary": "Natural-language search over SnowLive resorts and docs (GET alias)",
        "description": "Unversioned alias for `/v1/ask` implementing the NLWeb v0.55 GET contract with cursor pagination.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "Natural-language search query.",
            "schema": { "type": "string", "minLength": 1, "example": "Zermatt avalanche and snow forecast" }
          },
          { "$ref": "#/components/parameters/Cursor" },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results per page (default 10, max 25).",
            "schema": { "type": "integer", "minimum": 1, "maximum": 25, "default": 10 }
          },
          {
            "name": "streaming",
            "in": "query",
            "required": false,
            "description": "Set to true to receive a text/event-stream SSE response.",
            "schema": { "type": "boolean", "default": false }
          }
        ],
        "responses": {
          "200": {
            "description": "NLWeb v0.55 ranked search results",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AskResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      },
      "post": {
        "tags": ["NLWeb Search"],
        "operationId": "askPost",
        "summary": "Natural-language search over SnowLive resorts and docs (POST alias)",
        "description": "Unversioned alias for `/v1/ask` implementing the NLWeb v0.55 POST contract with cursor pagination.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          { "$ref": "#/components/parameters/IdempotencyKey" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/AskRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "NLWeb v0.55 ranked search results",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AskResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/mcp": {
      "get": {
        "tags": ["MCP"],
        "operationId": "getMcpRootDiscovery",
        "summary": "Get SnowLive MCP server discovery metadata (/mcp)",
        "description": "Root Streamable HTTP MCP discovery endpoint returning server metadata, tool catalog, resources, and related discovery links.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" }
        ],
        "responses": {
          "200": {
            "description": "MCP server discovery metadata",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpDiscoveryResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      },
      "post": {
        "tags": ["MCP"],
        "operationId": "invokeMcpRootJsonRpc",
        "summary": "Execute an MCP JSON-RPC 2.0 request at /mcp",
        "description": "Stateless Streamable HTTP MCP endpoint supporting initialize, notifications/initialized, ping, tools/list, tools/call, resources/list, and resources/read.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          { "$ref": "#/components/parameters/IdempotencyKey" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/McpJsonRpcRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response payload",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpJsonRpcResponse" }
              }
            }
          },
          "202": {
            "description": "Accepted (for MCP notifications such as notifications/initialized)"
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "tags": ["MCP"],
        "operationId": "getMcpDiscovery",
        "summary": "Get SnowLive MCP server discovery metadata (/api/mcp)",
        "description": "Returns a JSON discovery card describing the SnowLive Streamable HTTP MCP server, supported tools, resources, and related discovery URLs.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" }
        ],
        "responses": {
          "200": {
            "description": "MCP server discovery metadata",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpDiscoveryResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      },
      "post": {
        "tags": ["MCP"],
        "operationId": "invokeMcpJsonRpc",
        "summary": "Execute an MCP JSON-RPC 2.0 request (/api/mcp)",
        "description": "Stateless Streamable HTTP MCP endpoint supporting initialize, notifications/initialized, ping, tools/list, tools/call (list_resorts, get_resort_conditions, get_resort_routes, get_resort_guide, compare_resorts), resources/list, and resources/read.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          { "$ref": "#/components/parameters/IdempotencyKey" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/McpJsonRpcRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response payload",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpJsonRpcResponse" }
              }
            }
          },
          "202": {
            "description": "Accepted (for MCP notifications such as notifications/initialized)"
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/resort-traffic": {
      "get": {
        "tags": ["Live Conditions"],
        "operationId": "getResortTraffic",
        "summary": "Fetch live mountain highway traffic, chain laws, and road cameras",
        "description": "Returns live highway corridor status, drive time delays, active winter chain requirements, road incidents, and DOT road camera feeds for a ski resort (Caltrans QuickMap, DriveBC Open511, Bison Futé, Open Data Hub Südtirol, or estimated corridor fallback).",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Canonical resort slug ID (e.g. 'val-thorens', 'palisades-tahoe', 'whistler-blackcomb').",
            "schema": { "type": "string", "pattern": "^[a-z0-9-]{2,64}$", "example": "palisades-tahoe" }
          }
        ],
        "responses": {
          "200": {
            "description": "Live mountain corridor traffic and chain-law telemetry",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ResortTrafficResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/geo-context": {
      "get": {
        "tags": ["Live Conditions"],
        "operationId": "getGeoContext",
        "summary": "Resolve privacy-clean edge geolocation, currency, and nearest ski gateway airport",
        "description": "Reads Cloudflare edge geolocation headers without setting cookies or storing PII. Returns ISO country code, city, preferred currency, nearest major airport IATA code, and coarse coordinates.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" }
        ],
        "responses": {
          "200": {
            "description": "Regional defaults and nearest airport hub",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/GeoContextResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/live-avalanche": {
      "get": {
        "tags": ["Live Conditions"],
        "operationId": "getLiveAvalanche",
        "summary": "Fetch official live avalanche danger rating by coordinates",
        "description": "Queries official avalanche centers (avalanche.org for USA, SLF for Switzerland, EAWS Euregio for Tirol/Südtirol/Trentino) and falls back to estimated when outside official polygon coverage.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "description": "Latitude in decimal degrees",
            "schema": { "type": "number", "example": 45.9237 }
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "description": "Longitude in decimal degrees",
            "schema": { "type": "number", "example": 6.8694 }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Optional country hint (e.g. USA, Switzerland, Italy, Austria)",
            "schema": { "type": "string", "example": "Switzerland" }
          }
        ],
        "responses": {
          "200": {
            "description": "Avalanche bulletin status",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AvalancheResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/resort-osm": {
      "get": {
        "tags": ["Topology & Guides"],
        "operationId": "getResortOsm",
        "summary": "Fetch OpenStreetMap pistes, lifts, and peaks for a ski resort",
        "description": "Serves pre-baked static OSM trail topology when available, or queries Overpass API mirrors and caches the result at the Cloudflare edge.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Resort slug ID (lowercase alphanumeric and hyphens)",
            "schema": { "type": "string", "pattern": "^[a-z0-9-]{2,64}$", "example": "chamonix" }
          },
          {
            "name": "south",
            "in": "query",
            "required": true,
            "description": "Bounding box south latitude",
            "schema": { "type": "number", "example": 45.88 }
          },
          {
            "name": "west",
            "in": "query",
            "required": true,
            "description": "Bounding box west longitude",
            "schema": { "type": "number", "example": 6.82 }
          },
          {
            "name": "north",
            "in": "query",
            "required": true,
            "description": "Bounding box north latitude",
            "schema": { "type": "number", "example": 46.04 }
          },
          {
            "name": "east",
            "in": "query",
            "required": true,
            "description": "Bounding box east longitude",
            "schema": { "type": "number", "example": 6.98 }
          }
        ],
        "responses": {
          "200": {
            "description": "OSM pistes, lifts, and peaks JSON",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ResortOsmResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/api/resort-events": {
      "get": {
        "tags": ["Topology & Guides"],
        "operationId": "getResortEvents",
        "summary": "Fetch daily refreshed events and activities for a ski resort",
        "description": "Returns curated and daily refreshed resort events, races, après-ski highlights, and activities from the SnowLive catalog.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Resort slug ID",
            "schema": { "type": "string", "pattern": "^[a-z0-9-]{2,64}$", "example": "aspen-snowmass" }
          }
        ],
        "responses": {
          "200": {
            "description": "Resort events payload",
            "headers": {
              "X-API-Version": { "$ref": "#/components/headers/XApiVersion" },
              "RateLimit": { "$ref": "#/components/headers/RateLimit" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ResortEventsResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    },
    "/data/catalog/index.json": {
      "get": {
        "tags": ["Topology & Guides"],
        "operationId": "getCatalogIndex",
        "summary": "Get the verified global ski resort catalog index",
        "description": "Returns summary metadata, coordinates, elevations, and country catalog file pointers for all global catalog ski resorts.",
        "parameters": [
          { "$ref": "#/components/parameters/XApiVersion" }
        ],
        "responses": {
          "200": {
            "description": "Global ski resort catalog index JSON",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CatalogIndexResponse" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "500": { "$ref": "#/components/responses/InternalServerError" }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "XApiVersion": {
        "name": "X-API-Version",
        "in": "header",
        "required": false,
        "description": "Optional API version pin (currently '1.0').",
        "schema": { "type": "string", "default": "1.0", "example": "1.0" }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional client-generated idempotency key for safe request retries on POST endpoints.",
        "schema": { "type": "string", "minLength": 1, "maxLength": 128, "example": "550e8400-e29b-41d4-a716-446655440000" }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "Opaque pagination cursor returned as `next_cursor` from a previous response.",
        "schema": { "type": "string", "example": "eyJvZmZzZXQiOjEwfQ==" }
      }
    },
    "headers": {
      "XApiVersion": {
        "description": "Active API version serving the response.",
        "schema": { "type": "string", "example": "1.0" }
      },
      "RateLimit": {
        "description": "IETF draft RateLimit header reporting quota limit, remaining tokens, and window reset in seconds.",
        "schema": { "type": "string", "example": "limit=120, remaining=119, reset=60" }
      },
      "RateLimitPolicy": {
        "description": "IETF draft RateLimit-Policy header describing the quota window.",
        "schema": { "type": "string", "example": "120;w=60" }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed request body or invalid query parameters",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" }
          }
        }
      },
      "NotFound": {
        "description": "Requested resource or resort ID was not found",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit exceeded; retry after the window indicated in RateLimit headers",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" }
          }
        }
      },
      "InternalServerError": {
        "description": "Unexpected server or upstream telemetry provider error",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" }
          }
        }
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "required": ["error", "code", "message", "docs"],
        "properties": {
          "error": { "type": "string", "description": "Machine-readable error identifier.", "example": "invalid_request" },
          "code": { "type": "integer", "description": "HTTP or JSON-RPC numeric error code.", "example": 400 },
          "message": { "type": "string", "description": "Human-readable explanation of the error.", "example": "Missing required query parameter." },
          "docs": { "type": "string", "format": "uri", "description": "Link to API documentation.", "example": "https://snowlive.io/openapi.json" }
        }
      },
      "AskQueryInput": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": { "type": "string", "description": "Natural-language question or search query." }
        }
      },
      "AskPreferInput": {
        "type": "object",
        "properties": {
          "streaming": { "type": "boolean", "default": false, "description": "Whether to stream results via SSE." },
          "response_format": { "type": "string", "enum": ["json", "markdown"], "default": "json" }
        }
      },
      "AskRequest": {
        "type": "object",
        "required": ["query"],
        "properties": {
          "query": { "$ref": "#/components/schemas/AskQueryInput" },
          "cursor": { "type": ["string", "null"], "description": "Optional cursor from a prior response's next_cursor." },
          "limit": { "type": "integer", "minimum": 1, "maximum": 25, "default": 10 },
          "prefer": { "$ref": "#/components/schemas/AskPreferInput" }
        }
      },
      "AskMeta": {
        "type": "object",
        "required": ["response_type", "version"],
        "properties": {
          "response_type": { "type": "string", "example": "answer" },
          "version": { "type": "string", "example": "0.55" }
        }
      },
      "AskResultItem": {
        "type": "object",
        "required": ["@type", "name", "url", "description"],
        "properties": {
          "@type": { "type": "string", "example": "SkiResort" },
          "name": { "type": "string", "example": "Val Thorens" },
          "url": { "type": "string", "format": "uri", "example": "https://snowlive.io/?resort=val-thorens" },
          "description": { "type": "string" },
          "score": { "type": "number", "minimum": 0, "maximum": 1 },
          "markdownUrl": { "type": ["string", "null"], "format": "uri" }
        }
      },
      "AskResponse": {
        "type": "object",
        "required": ["_meta", "results", "next_cursor", "has_more"],
        "properties": {
          "_meta": { "$ref": "#/components/schemas/AskMeta" },
          "results": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/AskResultItem" }
          },
          "next_cursor": { "type": ["string", "null"], "description": "Opaque cursor for fetching the next page, or null when no more results exist." },
          "has_more": { "type": "boolean", "description": "True if additional pages are available." }
        }
      },
      "McpToolSummary": {
        "type": "object",
        "required": ["name", "description"],
        "properties": {
          "name": { "type": "string" },
          "description": { "type": "string" }
        }
      },
      "McpResourceSummary": {
        "type": "object",
        "required": ["uri", "name", "mimeType"],
        "properties": {
          "uri": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "mimeType": { "type": "string" }
        }
      },
      "McpDiscoveryLinks": {
        "type": "object",
        "properties": {
          "website": { "type": "string", "format": "uri" },
          "serverCard": { "type": "string", "format": "uri" },
          "mcpManifest": { "type": "string", "format": "uri" },
          "ard": { "type": "string", "format": "uri" },
          "apiCatalog": { "type": "string", "format": "uri" },
          "openApi": { "type": "string", "format": "uri" },
          "llmsTxt": { "type": "string", "format": "uri" },
          "llmsFullTxt": { "type": "string", "format": "uri" }
        }
      },
      "McpDiscoveryResponse": {
        "type": "object",
        "required": ["name", "title", "version", "protocolVersion", "transport", "endpoint", "tools", "resources"],
        "properties": {
          "name": { "type": "string", "example": "snowlive-mcp" },
          "title": { "type": "string", "example": "SnowLive Global 3D Ski Resorts MCP Server" },
          "version": { "type": "string", "example": "1.1.0" },
          "description": { "type": "string" },
          "protocolVersion": { "type": "string", "example": "2025-03-26" },
          "transport": { "type": "string", "example": "streamable-http" },
          "endpoint": { "type": "string", "format": "uri" },
          "authentication": { "type": "string", "example": "none" },
          "tools": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/McpToolSummary" }
          },
          "resources": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/McpResourceSummary" }
          },
          "links": { "$ref": "#/components/schemas/McpDiscoveryLinks" }
        }
      },
      "McpJsonRpcParams": {
        "type": "object",
        "properties": {
          "protocolVersion": { "type": "string" },
          "name": { "type": "string", "description": "Tool name for tools/call." },
          "uri": { "type": "string", "description": "Resource URI for resources/read." },
          "arguments": {
            "type": "object",
            "description": "Tool-specific input arguments.",
            "additionalProperties": true
          }
        }
      },
      "McpJsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "method": {
            "type": "string",
            "enum": [
              "initialize",
              "notifications/initialized",
              "ping",
              "tools/list",
              "tools/call",
              "resources/list",
              "resources/read"
            ]
          },
          "params": { "$ref": "#/components/schemas/McpJsonRpcParams" }
        }
      },
      "McpJsonRpcError": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": { "type": "integer", "example": -32602 },
          "message": { "type": "string", "example": "Invalid params" }
        }
      },
      "McpContentItem": {
        "type": "object",
        "required": ["type", "text"],
        "properties": {
          "type": { "type": "string", "example": "text" },
          "text": { "type": "string" }
        }
      },
      "McpJsonRpcResult": {
        "type": "object",
        "properties": {
          "protocolVersion": { "type": "string" },
          "instructions": { "type": "string" },
          "content": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/McpContentItem" }
          },
          "structuredContent": {
            "type": "object",
            "description": "Typed structured payload matching the tool outputSchema.",
            "additionalProperties": true
          },
          "isError": { "type": "boolean" }
        }
      },
      "McpJsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc", "id"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "result": { "$ref": "#/components/schemas/McpJsonRpcResult" },
          "error": { "$ref": "#/components/schemas/McpJsonRpcError" }
        }
      },
      "TrafficIncident": {
        "type": "object",
        "required": ["id", "severity", "title", "roadName", "source"],
        "properties": {
          "id": { "type": "string" },
          "severity": { "type": "string", "enum": ["info", "warn", "critical"] },
          "title": { "type": "string" },
          "roadName": { "type": "string" },
          "updatedAt": { "type": "string", "format": "date-time" },
          "source": { "type": "string" }
        }
      },
      "RoadCamera": {
        "type": "object",
        "required": ["id", "name", "locationLabel", "imageUrl", "proxiedUrl", "host"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "locationLabel": { "type": "string" },
          "imageUrl": { "type": "string", "format": "uri" },
          "proxiedUrl": { "type": "string" },
          "host": { "type": "string" }
        }
      },
      "TrafficAttribution": {
        "type": "object",
        "required": ["providerName", "officialUrl"],
        "properties": {
          "providerName": { "type": "string" },
          "officialUrl": { "type": "string", "format": "uri" }
        }
      },
      "ResortTrafficResponse": {
        "type": "object",
        "required": [
          "resortId",
          "corridorId",
          "corridorName",
          "gatewayCity",
          "provenance",
          "status",
          "typicalDriveMin",
          "liveDriveMin",
          "delayMinutes",
          "chainRequirement",
          "summary",
          "incidents",
          "roadCameras",
          "attribution",
          "fetchedAt"
        ],
        "properties": {
          "resortId": { "type": "string" },
          "corridorId": { "type": "string" },
          "corridorName": { "type": "string" },
          "gatewayCity": { "type": "string" },
          "provenance": { "type": "string", "enum": ["live", "hybrid", "estimated"] },
          "status": { "type": "string", "enum": ["open", "delay", "chain-law", "restricted", "closed"] },
          "typicalDriveMin": { "type": "integer" },
          "liveDriveMin": { "type": "integer" },
          "delayMinutes": { "type": "integer" },
          "chainRequirement": { "type": "string", "enum": ["none", "winter-tires", "awd-or-chains", "chains-mandatory"] },
          "summary": { "type": "string" },
          "incidents": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/TrafficIncident" }
          },
          "roadCameras": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/RoadCamera" }
          },
          "attribution": { "$ref": "#/components/schemas/TrafficAttribution" },
          "fetchedAt": { "type": "string", "format": "date-time" }
        }
      },
      "GeoContextResponse": {
        "type": "object",
        "required": ["country", "city", "currency", "nearestAirportCode", "lat", "lon"],
        "properties": {
          "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code.", "example": "US" },
          "city": { "type": ["string", "null"], "example": "Denver" },
          "currency": { "type": "string", "enum": ["USD", "EUR", "CHF", "GBP", "CAD", "ILS", "JPY", "AUD", "NZD"] },
          "nearestAirportCode": { "type": "string", "description": "Nearest major airport IATA code.", "example": "DEN" },
          "lat": { "type": ["number", "null"] },
          "lon": { "type": ["number", "null"] }
        }
      },
      "AvalancheResponse": {
        "type": "object",
        "required": ["source"],
        "properties": {
          "source": { "type": "string", "enum": ["live", "estimated"] },
          "risk": { "type": "integer", "minimum": 1, "maximum": 5 },
          "center": { "type": "string" },
          "zoneName": { "type": "string" },
          "advice": { "type": "string" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "OsmPiste": {
        "type": "object",
        "required": ["id", "name", "difficulty"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "difficulty": { "type": "string" },
          "grooming": { "type": "string" },
          "coords": {
            "type": "array",
            "items": {
              "type": "array",
              "items": { "type": "number" },
              "minItems": 2,
              "maxItems": 2
            }
          }
        }
      },
      "OsmLift": {
        "type": "object",
        "required": ["id", "name", "type"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "type": { "type": "string" },
          "capacity": { "type": ["integer", "null"] },
          "occupancy": { "type": ["integer", "null"] }
        }
      },
      "OsmPeak": {
        "type": "object",
        "required": ["id", "name", "lat", "lon"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "lat": { "type": "number" },
          "lon": { "type": "number" },
          "ele": { "type": ["number", "null"] }
        }
      },
      "ResortOsmResponse": {
        "type": "object",
        "required": ["pistes", "lifts", "peaks"],
        "properties": {
          "pistes": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/OsmPiste" }
          },
          "lifts": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/OsmLift" }
          },
          "peaks": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/OsmPeak" }
          },
          "degraded": { "type": "boolean" }
        }
      },
      "ResortEventItem": {
        "type": "object",
        "required": ["id", "title", "category"],
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "category": { "type": "string" },
          "timeLabel": { "type": "string" },
          "location": { "type": "string" },
          "description": { "type": "string" },
          "bookingUrl": { "type": "string", "format": "uri" }
        }
      },
      "ResortEventsResponse": {
        "type": "object",
        "required": ["resortId", "source", "events"],
        "properties": {
          "resortId": { "type": "string" },
          "source": { "type": "string", "enum": ["daily-activities", "catalog-fallback", "none"] },
          "refreshedAt": { "type": "string", "format": "date-time" },
          "lastVerifiedAt": { "type": "string", "format": "date-time" },
          "reachable": { "type": "boolean" },
          "events": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ResortEventItem" }
          }
        }
      },
      "CatalogTotals": {
        "type": "object",
        "properties": {
          "resorts": { "type": "integer" },
          "countries": { "type": "integer" },
          "webcams": { "type": "integer" },
          "venues": { "type": "integer" },
          "events": { "type": "integer" }
        }
      },
      "CatalogCountrySummary": {
        "type": "object",
        "required": ["country", "count", "file"],
        "properties": {
          "country": { "type": "string" },
          "count": { "type": "integer" },
          "file": { "type": "string" }
        }
      },
      "CatalogResortSummary": {
        "type": "object",
        "required": ["id", "name", "country", "region", "lat", "lon", "baseElevationM", "summitElevationM"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "country": { "type": "string" },
          "region": { "type": "string" },
          "catalogFile": { "type": "string" },
          "lat": { "type": "number" },
          "lon": { "type": "number" },
          "baseElevationM": { "type": "number" },
          "summitElevationM": { "type": "number" },
          "verticalDropM": { "type": "number" }
        }
      },
      "CatalogIndexResponse": {
        "type": "object",
        "required": ["schemaVersion", "generatedAt", "totals", "countries", "resorts"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "totals": { "$ref": "#/components/schemas/CatalogTotals" },
          "countries": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CatalogCountrySummary" }
          },
          "resorts": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CatalogResortSummary" }
          }
        }
      }
    }
  }
}
