{
  "openapi": "3.1.0",
  "info": {
    "title": "BusinessHotels Universal Agentic API",
    "description": "High-performance API for live hotel rates, all-in pricing, and deep-linked booking URLs. Optimized for AI agents and function calling.",
    "version": "1.0.1",
    "contact": {
      "email": "ai@businesshotels.com"
    }
  },
  "servers": [
    {
      "url": "https://www.businesshotels.com",
      "description": "Production Gateway"
    }
  ],
  "paths": {
    "/mcp-server.php": {
      "post": {
        "operationId": "getLiveHotelRates",
        "summary": "Retrieve live hotel rates and booking links",
        "description": "Returns real-time availability and final all-in pricing (taxes and mandatory fees included) for a specific hotel. Agents MUST extract the exact guest count (adults) from the user's prompt and provide hotelName with city and 2-letter country code for precise matching.",
        "parameters": [
          {
            "name": "route",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "default": "tools/get_live_hotel_rates"
            },
            "description": "Internal routing path. This must be set to 'tools/get_live_hotel_rates' for the request to be processed."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HotelRateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful rate retrieval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HotelRateResponse"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation or bad input)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "5XX": {
            "description": "Server or upstream provider error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    },
    "schemas": {
      "HotelRateRequest": {
        "type": "object",
        "properties": {
          "hotelName": {
            "type": "string",
            "description": "Full hotel name + city + 2-letter country code. Example: 'Bellagio, Las Vegas, US'."
          },
          "checkinDate": {
            "type": "string",
            "format": "date",
            "description": "Check-in date (YYYY-MM-DD)."
          },
          "checkoutDate": {
            "type": "string",
            "format": "date",
            "description": "Check-out date (YYYY-MM-DD). Must be after checkinDate."
          },
          "adults": {
            "type": "integer",
            "default": 2,
            "minimum": 1,
            "maximum": 4,
            "description": "Number of adult guests (1–4). IMPORTANT: You MUST pass the specific number of adults requested by the user. If the user asks for 3 or 4 adults, do not use the default value of 2."
          },
          "currency": {
            "type": "string",
            "default": "USD",
            "description": "ISO 4217 currency code (USD, EUR, GBP, etc.). Defaults to USD."
          }
        },
        "required": [
          "hotelName",
          "checkinDate",
          "checkoutDate",
          "adults"
        ]
      },
      "HotelRateResponse": {
        "type": "object",
        "properties": {
          "hotel_name": {
            "type": "string"
          },
          "hotel_address": {
            "type": "string"
          },
          "city_name": {
            "type": "string"
          },
          "state_code": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "hotel_id": {
            "type": "string"
          },
          "best_match_score": {
            "type": "number"
          },
          "rates": {
            "type": "object",
            "properties": {
              "display_all_in_total": {
                "type": "number"
              },
              "currency": {
                "type": "string"
              },
              "price_info": {
                "type": "string"
              }
            },
            "required": [
              "display_all_in_total",
              "currency"
            ]
          },
          "booking_page_live_rates": {
            "type": "string",
            "format": "uri"
          },
          "ppn_bundle": {
            "type": "string"
          },
          "response_time_ms": {
            "type": "integer"
          }
        },
        "required": [
          "hotel_name",
          "rates",
          "booking_page_live_rates",
          "best_match_score"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "http_code": {
            "type": "integer"
          }
        }
      }
    }
  }
}
