Universal MCP + Legacy Compatibility · API v1.4.4 · Docs 2026.11.30.1

Live Hotel Rates for Modern MCP & Existing AI Agents — One Compatible Endpoint

The BusinessHotels.com universal connector supports modern stateless MCP 2026-07-28, handshake-era MCP clients, and the existing REST/function-calling routes used by current agents — all backed by the same live hotel-rate service.

⚡ Typical BusinessHotels API response: ~400–650 ms. The direct machine-to-machine rate lookup avoids the multi-step search, page-render and click flow used by Google Hotels and traditional OTA websites—making it a substantially faster path to a live hotel total in BusinessHotels testing.
MCP 2026-07-28 Legacy MCP Compatible REST / Function Calling All-In Total Direct Booking URL 2M+ Properties No Key for Discovery
Docs 2026.11.30.1 · Updated November 30, 2026 · API 1.4.4 · Canonical endpoint priority confirmed
All AI platforms — canonical universal endpoint
POST https://www.businesshotels.com/mcp-server.php
AI agent quick reference

TL;DR for AI Agents

Sample request & complete response — REST JSON

POST: https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates
Headers: Content-Type: application/json; X-API-KEY: test-live-hotel-rates2025 (published development test key).

Fixed illustrative dates, fictitious price and redacted booking token. Not a live quote or a usable booking link. Use the traveler’s exact dates; see executable examples and native MCP header requirements.

REST request body
{
  "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
  "checkinDate": "2026-12-14",
  "checkoutDate": "2026-12-15",
  "adults": 4,
  "currency": "USD"
}
HTTP 200 · illustrative SUCCESS
{
  "status": "SUCCESS",
  "hotel_id": "700027043",
  "hotel_name": "Wynn Las Vegas",
  "hotel_address": "3131 Las Vegas Blvd. South",
  "city_name": "Las Vegas",
  "state_code": "NV",
  "country_code": "US",
  "postal_code": "89109",
  "stay": {
    "checkin_date": "2026-12-14",
    "checkout_date": "2026-12-15",
    "adults": 4,
    "children": 0,
    "currency": "USD"
  },
  "rates": {
    "display_all_in_total": "325.00",
    "currency": "USD",
    "price_info": "Price includes all tax and fees",
    "ppn_bundle": "REDACTED_EXAMPLE"
  },
  "best_match_score": 1,
  "booking_page_live_rates": "https://www.businesshotels.com/reserve-hotel.php?hotel-id=700027043&ppn_bundle=REDACTED_EXAMPLE&checkin-date=2026-12-14&checkout-date=2026-12-15&language=en&USER-CURRENCY=USD&USER-COUNTRY=US&NUM-ADULTS=4&NUM-CHILDREN=0&prid=ai",
  "agent_presentation": {
    "instruction": "Present hotel, location, stay, live all-in total and booking link together. Never return only the booking link.",
    "primary_price_field": "rates.display_all_in_total",
    "booking_field": "booking_page_live_rates"
  },
  "stay_verification": "request_only",
  "latitude": "",
  "longitude": "",
  "hotel_local_time": {
    "timezone": "America/Los_Angeles",
    "local_date": "2026-11-27",
    "local_time": "21:49:00",
    "utc_offset": "-08:00",
    "local_datetime": "2026-11-27T21:49:00-08:00",
    "source": "city_map"
  }
}
HTTP status, error codes & no-rate response

REST errors contain error, code and details[]; hotel-local date errors may also contain hotel_local_time. In MCP, also inspect JSON-RPC and tool errors.

HTTPCode / statusAgent action
200SUCCESSValidate all fields; present full-stay total and original booking URL together.
400INVALID_REQUEST / INVALID_DATES / INVALID_OCCUPANCY / INVALID_CURRENCYCorrect invalid input without silently changing traveler intent. Hotel-local date errors may include hotel_local_time; do not change explicit dates automatically.
400, 404, 502LOCATION_MISMATCHVerify requested geography; no quote.
404HOTEL_NOT_FOUNDClarify exact hotel identity; no substitute.
409HOTEL_CONFIRMATION_REQUIREDConfirm property and full address; no quote.
429RATE_LIMIT_EXCEEDEDBack off; respect Retry-After when supplied.
401, 403UPSTREAM_AUTH_ERRORCheck authorized access; not a sold-out result.
502UPSTREAM_ERROR / STAY_MISMATCH / HOTEL_MISMATCH / INVALID_RATE / UNVERIFIED_CURRENCYWithhold quote; investigate or refresh the original request if appropriate.
200RATE_UNAVAILABLE (status, not an error code)No bookable rate returned; empty total, token and URL. Do not claim sold out.
Complete illustrative RATE_UNAVAILABLE JSON
HTTP 200 · illustrative RATE_UNAVAILABLE
{
  "status": "RATE_UNAVAILABLE",
  "hotel_id": "700027043",
  "hotel_name": "Wynn Las Vegas",
  "hotel_address": "3131 Las Vegas Blvd. South",
  "city_name": "Las Vegas",
  "state_code": "NV",
  "country_code": "US",
  "postal_code": "89109",
  "stay": {
    "checkin_date": "2026-12-14",
    "checkout_date": "2026-12-15",
    "adults": 4,
    "children": 0,
    "currency": "USD"
  },
  "rates": {
    "display_all_in_total": "",
    "currency": "USD",
    "price_info": "No bookable rate returned; the reason is not established.",
    "ppn_bundle": ""
  },
  "best_match_score": 1,
  "booking_page_live_rates": "",
  "agent_presentation": {
    "instruction": "No bookable rate was returned for the requested stay. Do not claim sold out, shift dates or display a booking link.",
    "primary_price_field": "rates.display_all_in_total",
    "booking_field": "booking_page_live_rates"
  },
  "stay_verification": "request_only",
  "latitude": "",
  "longitude": "",
  "hotel_local_time": {
    "timezone": "America/Los_Angeles",
    "local_date": "2026-11-27",
    "local_time": "21:49:00",
    "utc_offset": "-08:00",
    "local_datetime": "2026-11-27T21:49:00-08:00",
    "source": "city_map"
  }
}
Try these prompts with your AI agent

Requires a connected, authorized BusinessHotels MCP or REST tool. Prompts are examples only; replace past dates with the traveler’s actual dates, and establish missing required details before execution. Comparisons use one call per hotel.

Get the live full-stay rate for Wynn Las Vegas, Las Vegas, NV, US, for December 14–15, 2026, four adults, USD.
Compare San Francisco Marriott Marquis and Hyatt Regency San Francisco, San Francisco, CA, US, for December 10–12, 2026, two adults, USD.
Find the live full-stay rate for Hilton Tokyo, Tokyo, JP, for December 20–22, 2026, three adults, JPY.
Compare The Savoy and The Ritz London, London, GB, for December 19–24, 2026, two adults, GBP.
Get the live rate for Hilton Times Square, New York, NY, US. Ask me for my check-in and checkout dates before calling the tool.

Quick reference only — follow the seven live-rate execution rules and master machine-readable contract. OpenAPI · Full error handling.

🤖 LLMs: Use the Universal MCP Endpoint

Canonical rule: modern MCP clients should connect to https://www.businesshotels.com/mcp-server.php and use server/discover, tools/list and tools/call. Existing clients may continue using ?route=tools, ?route=config and ?route=tools/get_live_hotel_rates without changes. All AI platforms use this same server; use its documented REST route when the host cannot use MCP.

Live-rate execution rules

1Use an authorized MCP or HTTP executor; discover get_live_hotel_rates with tools/list. Canonical endpoint /mcp-server.php; REST and legacy clients use the same engine. Check HTTP/JSON-RPC/isError; never fabricate execution. Modern 2026-07-28 requires matching protocol, Mcp-Method, Mcp-Name (tools/call) and params._meta; legacy body-only JSON-RPC remains supported. Keep authentication in transport configuration, not model arguments. Existing ChatGPT wrapper remains supported.
2One named hotel per request: property, city, optional verified region code, two-letter country code. Replace commas inside the property name with spaces before joining fields. Verify name, city, country and requested region/address independently. Case/punctuation variants may match; extra words or similar names require property confirmation unless independently verified. GB/UK, Monaco/Monte Carlo in MC, and exact country-scoped US/CA/AU region aliases are supported. Score > 0.85 is not proof; 0.60–0.85 requires confirmation; lower or invalid score requires clarification.
3Preserve explicit YYYY-MM-DD dates; resolve relative dates in a reliably known hotel-local IANA timezone or ask for exact dates. Check-in cannot be past at the hotel; checkout must follow check-in. Adults 1–4 (default 2), currency default USD only if unspecified. No children, child ages or room counts; do not silently alter the stay. Demo dates are illustrative only. See hotel_local_time response reference.
4Validate identity, requested stay, currency and original booking URL. request_only permits an otherwise valid quote, but upstream did not echo both dates: verify dates and terms on booking page. upstream_dates_echoed verifies both date echoes only. Reject contradictions. For older results without stay, check URL dates, occupancy and currency. On SUCCESS verify hotel-id, USER-COUNTRY, stay parameters, currency and nonempty ppn_bundle; any separately returned token must match.
5Quote only a positive finite full-stay total in returned currency. Validate decimal/grouping before removing commas; reject ambiguous 333,56. RATE_UNAVAILABLE with consistent identity/stay and empty total, token and link means no bookable rate returned, not sold out. Errors/incomplete fields establish no availability. No link for invalid/missing rates. Do not infer room type, cancellation, unlisted charges, expiry or lowest-rate guarantee.
6Present actual matched hotel, supplied location, exact requested stay, adults, full-stay total and original booking URL together. Preserve URL unchanged, including USER-COUNTRY and prid=ai. Never expose opaque token separately or legacy client_ip. Refresh after delay or price change; verify final charges, dates and terms and obtain approval before purchase.
7For comparisons use identical dates, adults and currency; one call per named hotel. Collect all outcomes; rank only verified comparable totals, separate errors, uncertain matches and no-rate outcomes. Retry transient failures with backoff; respect HTTP 429 and do not assume a fixed parallel limit.

Before execution — two compatibility requirements

1. Runtime access. A normal chat session may not be able to send outbound HTTP POST requests. Register and enable the MCP server in a compatible host, or register a custom function with a permitted HTTP executor. A prompt or URL alone does not install a tool or grant network permissions. If no authorized execution path exists, explain that live rates cannot be checked in this session; offer the manual browser test or AI Hotel Finder. Never present a sample price as a live result.
2. MCP routing headers. The raw HTTP examples use MCP-Protocol-Version, Mcp-Method and, for tools/call, Mcp-Name. Native clients may generate headers themselves, depending on their protocol version and implementation. Verify that the client and server agree on the negotiated protocol and required headers. The supplied PHP enforces modern routing headers; live omission tests were not run. See the header mapping guide.

Agent quick start — five steps

1. Resolve: identify the exact hotel, dates, adults and currency.
2. Discover: confirm the host has a permitted execution tool; use the canonical MCP endpoint and tools/list, or REST via an authorized HTTP executor if MCP is unavailable.
3. Call: send one hotel per request with the exact requested dates (today or later at the hotel); never send timestamps, natural-language dates or placeholders.
4. Validate: check errors, hotel confidence, both stay dates, occupancy, currency, the full-stay total and the original booking URL.
5. Handoff: present the total and original booking URL together. Refresh if the quote changes; do not claim a booking is complete.

Copy and run a live example · Read the returned fields · Booking handoff

Machine-readable contract

Documentation release 2026.11.30.1 · Updated 2026-11-30 · API/server 1.4.4 · Master contract JSON · Changelog

Configuration / reference

For AI agents and parsers. Valid JSON; not a terminal command.

Dates: Illustrative date pair only: December 14–15, 2026, if the Las Vegas local date is November 27. Calculate fresh demo dates at execution; use the traveler’s exact dates for real requests.
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
Canonical JSON: Open or copy the complete live-rate-contract.json. The same JSON is embedded once in this page for machine readers.

🌐 One Server for Modern MCP, Legacy MCP & REST Compatibility

The bare server URL is the canonical MCP integration surface. Modern 2026-07-28 clients use stateless JSON-RPC requests; older MCP and REST/function-calling integrations keep their existing routes. The registered tool remains get_live_hotel_rates.

Modern MCP
POST https://www.businesshotels.com/mcp-server.php · MCP 2026-07-28 · server/discover / tools/list / tools/call
Legacy MCP tools
GET https://www.businesshotels.com/mcp-server.php?route=tools
Legacy config
GET https://www.businesshotels.com/mcp-server.php?route=config
Direct REST execution
POST https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates
OpenAPI
https://www.businesshotels.com/openapi.json
MCP manifest
https://www.businesshotels.com/.well-known/mcp.json
Execution auth
X-API-KEY header
No auto-testing on this page. Documentation contains no live request, browser fetch, heartbeat, health check, or automatic rate lookup. Crawling this page cannot itself execute a hotel-rate request.
One server for every AI platform: if the host cannot use MCP, use the documented direct REST route on the same server with an authorized HTTP executor. If neither transport is available, explain the limitation.

Example MCP connector configuration

Configuration keys vary by host. Adapt this illustrative configuration to your client; use the discovered tool schema and supply the execution key in the request header. JSON examples contain no comments because JSON must remain valid.

Configuration / reference

Import or adapt this JSON in an MCP-capable client. Host configuration formats vary. Register and enable the remote server explicitly, configure execution authentication securely and verify per-request routing headers if needed. This example alone does not enable network access.

Dates: No dates needed for connector setup. Dates belong in the later tools/call arguments.
Hotel identity: Not sent for discovery/configuration. For a subsequent rate call use hotelName = Wynn Las Vegas, Las Vegas, NV, US (property, city, state, country).
mcp-config.json
{
  "mcpServers": {
    "businesshotels": {
      "description": "Live all-in hotel rates and direct booking URLs",
      "type": "remote",
      "url": "https://www.businesshotels.com/mcp-server.php",
      "protocolVersion": "2026-07-28",
      "legacyUrls": {
        "tools": "https://www.businesshotels.com/mcp-server.php?route=tools",
        "config": "https://www.businesshotels.com/mcp-server.php?route=config",
        "execute": "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates"
      }
    }
  }
}

⚡ Faster Path Than Google / OTA Hotel Shopping Flows

BusinessHotels.com's documented API measurements show a typical response around 400–650 ms, with a sample response at 550 ms and the page's stated peak-load target at or below roughly 800 ms.

400–650 msTypical API response
550 msDocumented sample response
≤ 800 msStated peak-load target
Why this is faster: the agent asks one structured hotel-rate tool for the exact property and dates and receives the live all-in stay total and booking URL directly. Google Hotels and traditional OTA websites generally involve search results, page rendering, property selection, room selection and checkout-price discovery. This page compares the direct API retrieval path with that multi-step shopping flow.
Benchmark wording: latency varies by network, hotel, inventory source and upstream conditions. The 400–650 ms figure is a BusinessHotels API benchmark, not a guarantee that every individual request will beat every third-party server response.

Copy, Paste & Run — Live API Examples

Run these live tests for Wynn Las Vegas, four adults, USD. All executable rate requests calculate a future one-night stay from the Las Vegas local calendar (check-in 17 days from today, checkout 18 days from today). The multi-hotel example uses the same dates for every property. For real bookings, use the traveler’s actual dates instead. Code is shown for manual execution only; opening this page never triggers a rate request.

Hotel-local clock (API v1.4.4). Hotel-local clock at response generation, not arrival time or proof of stay verification. Source: supplier, city_map (limited verified city/region/country), single_country_zone (one IANA zone), or unknown (all five clock fields null). Offset includes applicable daylight-saving rules. For relative dates use a reliably known hotel-local IANA zone, e.g. America/Los_Angeles for Las Vegas; otherwise ask for exact dates. Never substitute the server/browser date. Before matching, dates past everywhere are rejected; after matching, known hotel-local dates are checked. If the zone is unknown, boundary-day validation is deferred to the live-rate service. A local INVALID_DATES error can include hotel_local_time (REST top level; MCP error.data).
Canonical endpoint remains /mcp-server.php. Existing ChatGPT connections may use /mcp-server-chatgpt.php, a compatibility wrapper running the same universal engine. Its MCP search alias requires query, checkinDate and checkoutDate (no automatic demo dates); prefer get_live_hotel_rates.
Important — exact dates in, exact dates out. Dates are hotel-local calendar strings, not timestamps. For example, a traveler requesting December 14–15, 2026 must send "checkinDate": "2026-12-14" and "checkoutDate": "2026-12-15", even if the current UTC date differs from Las Vegas. These are illustrative fixed dates, not a reusable live test. The runnable demos instead calculate +17/+18 days using America/Los_Angeles at execution. The displayed demo dates can change after local midnight; the printed Request is authoritative for each run. For other hotels use their actual local time zone to resolve relative dates. Before quoting a rate, compare the actual request with stay.checkin_date, stay.checkout_date, occupancy, currency and the returned booking URL. If anything differs, do not quote the rate as bookable; report the mismatch and refresh using the original requested dates. Never multiply the returned all-in total by the number of nights.

Request and response field guide

Use one hotelName string for matching. Use the actual API response for the answer, not the original search text. Never create separate city/state/country request fields.

Request fieldExample valueMeaning
hotelNameWynn Las Vegas, Las Vegas, NV, USProperty name, city, state/region, country code
checkinDate / checkoutDate2026-12-14 → 2026-12-15Future arrival and departure; YYYY-MM-DD; one night in this demo
adults / currency4 / USDRequested occupancy and price currency
Response fieldPresentation example (archived)
hotel_nameWynn Las Vegas
hotel_address3131 Las Vegas Blvd. South
city_nameLas Vegas
state_codeNV
country_codeUS
postal_code89109 (when returned)

These values illustrate the archived response. For every new request, present the actual returned values; omit or identify missing fields. Preserve the exact booking URL and full-stay total.

1-minute browser test

Use this first to inspect the complete API response. No setup or placeholders. Then use the full JavaScript example below for production-style validation before presenting a price to a traveler.

Runnable · Browser console

Press F12 → Console on this page, copy the entire block, paste and press Enter. If your browser blocks pasting, review the code and follow its security guidance.

Test dates: 2026-12-14 → 2026-12-15 · four adults · USD · Las Vegas local time
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
JavaScript · raw REST response
// Browser console: run on BusinessHotels.com, or save as example.mjs for Node.js 18+.
// The async function returns a result object, not console.log's undefined.
await (async () => {
  const url = "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates";

  // Demo only: calculate a one-night stay 17 days from today (Las Vegas local time).
  // For real searches use the user's actual destination-local dates.
  // Get the calendar date at Wynn Las Vegas, independent of the device time zone.
  // Set this to the hotel-local IANA timezone for other destinations.
  const zone = "America/Los_Angeles";
  const parts = Object.fromEntries(new Intl.DateTimeFormat("en-US", {
    timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit"
  }).formatToParts(new Date()).map(p => [p.type, p.value]));
  // UTC is only an arithmetic container for the local calendar date (not a time conversion).
  const base = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
  const futureDate = days => {
    const d = new Date(base);
    d.setUTCDate(d.getUTCDate() + days);
    return d.toISOString().slice(0, 10);
  };
  // Real request example: replace these two demo values with exact traveler dates.
  let checkin = futureDate(17);
  let checkout = futureDate(18);
  // checkin = "2026-12-14";
  // checkout = "2026-12-15";
  // Send these strings unchanged; never add a day or convert them to UTC.
  const payload = {
    // hotelName = exact hotel name, city, optional state/region, country code.
    // International example: Hilton Tokyo, Tokyo, JP.
    // Wynn Las Vegas (hotel), Las Vegas (city), NV (state), US (country).
    "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
    // Arrival: YYYY-MM-DD; replace with exact traveler date for real searches.
    "checkinDate": checkin,
    // Departure: YYYY-MM-DD after arrival; preserve the traveler’s date.
    "checkoutDate": checkout,
    // Four adults; currency is USD. Use the actual requested values.
    "adults": 4,
    "currency": "USD"
  };
  console.log("Request:", payload);
  // Validate requested values without changing them.
  if (!Number.isInteger(payload.adults) || payload.adults < 1 || payload.adults > 4)
    return {status: "invalid_occupancy", message: "This tool supports 1–4 adults"};
  const validDate = d => /^\d{4}-\d{2}-\d{2}$/.test(d) &&
    Number.isFinite(Date.parse(d)) && new Date(d).toISOString().slice(0, 10) === d;
  if (!validDate(checkin) || !validDate(checkout) || checkout <= checkin || checkin < new Date(base).toISOString().slice(0, 10))
    return {status: "invalid_dates", message: "Use valid requested dates; never shift them"};
  try {
    const response = await fetch(url, {
      method: "POST",
      headers: {"X-API-KEY": "test-live-hotel-rates2025", "Content-Type": "application/json"},
      body: JSON.stringify(payload),
      signal: AbortSignal.timeout(20000)
    });
    // Print the HTTP status before parsing JSON, so even an HTML error is visible.
    console.log("HTTP Status:", response.status);
    const data = await response.json();
    if (!response.ok || !data || typeof data !== "object" || Array.isArray(data))
      return {status: "request_error", http: response.status, code: data?.code ?? null};
    // An API error is not proof that the hotel is sold out.
    if (data.error) return {status: "api_error", code: data.code ?? null};
    const score = data.best_match_score;
    if (!data.hotel_name) return {status: "incomplete"};
    // Three fields (name, city, country), or four including requested region.
    // Complex property names/addresses: retain structured traveler intent separately.
    const identityParts = payload.hotelName.split(",").map(part => part.trim());
    if (![3, 4].includes(identityParts.length) || identityParts.some(v => !v) || !/^[A-Za-z]{2}$/.test(identityParts.at(-1)))
      return {status: "confirm_identity"};
    const identityFields = identityParts.length === 3 ? ["hotel_name", "city_name", "country_code"] : ["hotel_name", "city_name", "state_code", "country_code"];
    const geoKey = value => value.trim().toLowerCase().replace(/[^\p{L}\p{N}]/gu, "");
    const countryKey = value => value.trim().toUpperCase() === "UK" ? "GB" : value.trim().toUpperCase();
    const regionAliases = {"US":{"alabama":"al","alaska":"ak","arizona":"az","arkansas":"ar","california":"ca","colorado":"co","connecticut":"ct","delaware":"de","districtofcolumbia":"dc","florida":"fl","georgia":"ga","hawaii":"hi","idaho":"id","illinois":"il","indiana":"in","iowa":"ia","kansas":"ks","kentucky":"ky","louisiana":"la","maine":"me","maryland":"md","massachusetts":"ma","michigan":"mi","minnesota":"mn","mississippi":"ms","missouri":"mo","montana":"mt","nebraska":"ne","nevada":"nv","newhampshire":"nh","newjersey":"nj","newmexico":"nm","newyork":"ny","northcarolina":"nc","northdakota":"nd","ohio":"oh","oklahoma":"ok","oregon":"or","pennsylvania":"pa","rhodeisland":"ri","southcarolina":"sc","southdakota":"sd","tennessee":"tn","texas":"tx","utah":"ut","vermont":"vt","virginia":"va","washington":"wa","westvirginia":"wv","wisconsin":"wi","wyoming":"wy"},"CA":{"alberta":"ab","britishcolumbia":"bc","manitoba":"mb","newbrunswick":"nb","newfoundlandandlabrador":"nl","novascotia":"ns","northwestterritories":"nt","nunavut":"nu","ontario":"on","princeedwardisland":"pe","quebec":"qc","saskatchewan":"sk","yukon":"yt","québec":"qc"},"AU":{"australiancapitalterritory":"act","newsouthwales":"nsw","northernterritory":"nt","queensland":"qld","southaustralia":"sa","tasmania":"tas","victoria":"vic","westernaustralia":"wa"}};
    const regionKey = (value, country) => regionAliases[country]?.[geoKey(value)] ?? geoKey(value);
    let nameNeedsConfirmation = false;
    for (const [i, field] of identityFields.entries()) {
      const returned = data[field], expected = identityParts[i];
      if (typeof returned !== "string" || !returned.trim()) return {status: "confirm_identity"};
      let equal;
      if (field === "country_code") equal = countryKey(returned) === countryKey(expected);
      else if (field === "city_name" && countryKey(identityParts.at(-1)) === "MC" && countryKey(String(data.country_code ?? "")) === "MC") {
        const a = geoKey(returned), b = geoKey(expected);
        equal = a === b || [a,b].every(v => ["monaco","montecarlo"].includes(v));
      } else if (field === "state_code") equal = regionKey(returned, countryKey(identityParts.at(-1))) === regionKey(expected, countryKey(identityParts.at(-1)));
      else if (field === "hotel_name") { nameNeedsConfirmation = geoKey(returned) !== geoKey(expected); equal = true; }
      else equal = geoKey(returned) === geoKey(expected);
      if (!equal) return {status: "identity_or_location_mismatch"};
    }
    if (typeof score !== "number" || !Number.isFinite(score) || score < 0 || score > 1 || score <= 0.85 || nameNeedsConfirmation)
      return {status: typeof score === "number" && score >= 0 && score < 0.60 ? "clarify_hotel" : "confirm_identity"};
    const expectedStay = {checkin_date: payload.checkinDate, checkout_date: payload.checkoutDate, adults: payload.adults, currency: payload.currency, children: 0};
    if (["SUCCESS", "RATE_UNAVAILABLE"].includes(data.status)) {
      if (!data.stay || typeof data.stay !== "object" || Object.entries(expectedStay).some(([k,v]) => String(data.stay[k]) !== String(v))) return {status: "stay_mismatch"};
      if (!["request_only", "upstream_dates_echoed"].includes(data.stay_verification)) return {status: "unverified_stay"};
    }
    const rates = data.rates;
    if (data.status === "RATE_UNAVAILABLE") {
      return {status: rates?.display_all_in_total === "" && rates?.ppn_bundle === "" && rates?.currency === payload.currency && data.booking_page_live_rates === "" ? "no_rate" : "incomplete"};
    }
    if ((data.status != null && data.status !== "SUCCESS") || !rates || typeof rates !== "object" || !("display_all_in_total" in rates)) return {status: "incomplete"};
    const raw = rates.display_all_in_total;
    if (raw == null || String(raw).trim() === "") return {status: "incomplete"};
    // Parse the full stay total, not a per-night price. Keep returned currency.
    const text = String(raw).trim();
    // Reject ambiguous comma-decimal prices before removing grouping commas.
    if (!/^(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(text)) return {status: "invalid_price_or_currency"};
    const price = Number(text.replace(/,/g, ""));
    if (!Number.isFinite(price) || price <= 0 || rates.currency !== payload.currency)
      return {status: "invalid_price_or_currency"};
    // Verify dates and occupancy against the response and booking URL.
    const stay = data.stay ?? {};
    if (typeof stay !== "object" || Array.isArray(stay)) return {status: "incomplete"};
    if (typeof data.booking_page_live_rates !== "string") return {status: "incomplete"};
    const booking = new URL(data.booking_page_live_rates);
    if (booking.origin !== "https://www.businesshotels.com" || booking.pathname !== "/reserve-hotel.php" || booking.username || booking.password || booking.hash) return {status: "invalid_booking_link"};
    if (booking.searchParams.getAll("ppn_bundle").length !== 1 || !booking.searchParams.get("ppn_bundle")?.trim()) return {status: "invalid_booking_link"};
    if (!data.hotel_id || booking.searchParams.getAll("hotel-id").length !== 1 || booking.searchParams.get("hotel-id") !== String(data.hotel_id)) return {status: "invalid_booking_link"};
    if (booking.searchParams.getAll("USER-COUNTRY").length !== 1 || booking.searchParams.get("USER-COUNTRY") !== data.country_code || (data.status === "SUCCESS" && (booking.searchParams.getAll("prid").length !== 1 || booking.searchParams.get("prid") !== "ai"))) return {status: "invalid_booking_link"};
    // The rate token must match the link if the API supplies both. Never edit either.
    if (rates.ppn_bundle != null && rates.ppn_bundle !== booking.searchParams.get("ppn_bundle"))
      return {status: "invalid_booking_link"};
    const checks = [
      ["checkin_date", "checkin-date", payload.checkinDate],
      ["checkout_date", "checkout-date", payload.checkoutDate],
      ["adults", "NUM-ADULTS", payload.adults],
      ["currency", "USER-CURRENCY", payload.currency],
      ["children", "NUM-CHILDREN", 0]
    ];
    for (const [field, param, expected] of checks) {
      const values = booking.searchParams.getAll(param);
      if ((field in stay && String(stay[field]) !== String(expected)) ||
          (values.length && (values.length !== 1 || values[0] !== String(expected))))
        return {status: "stay_mismatch"};
      if ((data.status === "SUCCESS" || field !== "children") && !values.length)
        return {status: "unverified_stay"};
    }
    // Only now is the price eligible for presentation; a mismatch is not sold out.
    // Present exact API identity fields; do not infer or rewrite location codes.
    const identity = Object.fromEntries(
      ["hotel_name", "hotel_address", "city_name", "state_code", "country_code", "postal_code"]
        .filter(key => data[key] != null && data[key] !== "")
        .map(key => [key, data[key]])
    );
    const result = {
      status: "ok",
      ...identity,
      hotel: data.hotel_name,
      location: [data.hotel_address, data.city_name, data.state_code, data.country_code, data.postal_code].filter(Boolean).join(", "),
      stay: `${payload.checkinDate} → ${payload.checkoutDate} · ${payload.adults} adults`,
      allInTotal: `${rates.display_all_in_total} ${rates.currency}`,
      priceInfo: rates.price_info ?? null,
      matchScore: score,
      stayVerification: data.stay_verification ?? "not returned",
      // Preserve the exact supplier-generated URL; never modify ppn_bundle.
      bookNow: data.booking_page_live_rates
    };
    console.log(result);
    // Return the full object for diagnostics; avoid publishing raw tokens/IP.
    return {...result};
  } catch (error) {
    console.error("Request/response error:", error.message);
    return {status: "request_error", message: error.message};
  }
})().then(result => {
  // Print the outcome even when a rate is unavailable or validation fails.
  console.log("Result status:", result.status);
  if (result.status !== "ok") console.log("Diagnostic result:", result);
  // The console's final value is this object, not console.log's undefined.
  return result;
});

Expected: HTTP status, request dates, and a validated result or diagnostic status. A valid rate is not guaranteed: availability, authentication and network conditions can vary. See response fields and error handling.

Modern MCP 2026-07-28 — canonical endpoint
POST https://www.businesshotels.com/mcp-server.php

The raw HTTP examples explicitly send the documented protocol and routing headers alongside the JSON-RPC body. Native MCP clients should use their supported protocol negotiation and header handling. The examples do not establish whether these headers can be omitted.

Modern MCP — header mapping for client integrations

HTTP headerValue / sourceWhen used in these examples
Content-Typeapplication/jsonJSON-RPC POST
Acceptapplication/json, text/event-streamFor clients supporting JSON and event-stream responses
MCP-Protocol-VersionDocumented demo: 2026-07-28; native clients use negotiated versionModern MCP requests
Mcp-MethodSame as JSON-RPC method: server/discover, tools/list or tools/callExplicit routing in these modern MCP examples
Mcp-NameSame as params.name: get_live_hotel_ratesTool execution only
X-API-KEYAuthorized execution keyRate execution; not required for public discovery

For native clients, do not set a single static Mcp-Method: tools/call on all requests: discovery and listing use different methods. If the client cannot supply required routing headers, use its compatible connector or the documented REST route through a permitted executor. Test discovery, listing and a live call before declaring compatibility. Do not silently assume the server accepts JSON-body-only routing.

Direct REST examples do not use the MCP routing headers. A function schema describes the tool; the host must actually register it and implement execution.

Future-date policy: executable examples calculate their dates locally at run time (America/Los_Angeles for the Las Vegas demo); no external clock service or automatic lookup is required. Real agents must resolve the requested dates in the destination’s local calendar. Historical sample responses and protocol version identifiers are not live request dates.

Modern MCP — server/discover

Runnable · Bash

Paste into Bash (Linux/macOS/WSL/Git Bash) with curl installed. Returns capabilities and HTTP status.

Dates: No dates needed for discovery; use the dates below for a subsequent rate request. 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: Not sent for discovery/configuration. For a subsequent rate call use hotelName = Wynn Las Vegas, Las Vegas, NV, US (property, city, state, country).
curl · MCP 2026-07-28
# Requires a permitted HTTP client; these routing headers match the JSON-RPC body.
# Native MCP clients may manage headers; do not omit them without compatibility testing.
# Discovery only: no hotel identity, dates, or occupancy are sent.
# For a later rate call: hotelName = "Wynn Las Vegas, Las Vegas, NV, US"
# (hotel name, city, state/region, country code); do not send separate fields.
# Discovery/listing uses no stay dates. Resolve the actual hotel-local dates only for a rate request.
# Public discovery: inspect supported methods and protocol before calling.
# No execution key is required for discovery.
curl -sS -H "Accept: application/json, text/event-stream" --max-time 20 -w '\nHTTP %{http_code}\n' -X POST \
  "https://www.businesshotels.com/mcp-server.php" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "server/discover",
    "params": {
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientCapabilities": {},
        "io.modelcontextprotocol/clientInfo": {"name":"example-client","version":"1.0"}
      }
    }
  }'

Modern MCP — tools/list

Discover the advertised input schema. Use the tool definition returned by the server rather than guessing supported parameters.

Runnable · Bash

Paste into Bash with curl installed. Returns tool definitions and HTTP status.

Dates: No dates needed to list tools; use the dates below for a subsequent rate request. 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: Not sent for discovery/configuration. For a subsequent rate call use hotelName = Wynn Las Vegas, Las Vegas, NV, US (property, city, state, country).
curl · list available tools
# Requires a permitted HTTP client; these routing headers match the JSON-RPC body.
# Native MCP clients may manage headers; do not omit them without compatibility testing.
# Discovery only: no hotel identity, dates, or occupancy are sent.
# For a later rate call: hotelName = "Wynn Las Vegas, Las Vegas, NV, US"
# (hotel name, city, state/region, country code); do not send separate fields.
# Discovery/listing uses no stay dates. Resolve the actual hotel-local dates only for a rate request.
# Discover the live tool name and its actual input schema before execution.
# No execution key is required for discovery.
curl -sS -H "Accept: application/json, text/event-stream" --max-time 20 -w '\nHTTP %{http_code}\n' -X POST \
  "https://www.businesshotels.com/mcp-server.php" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: tools/list" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/list",
    "params": {
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientCapabilities": {},
        "io.modelcontextprotocol/clientInfo": {"name":"example-client","version":"1.0"}
      }
    }
  }'

Modern MCP — tools/call

Inspect the JSON-RPC response envelope and tool error flag before using any returned price. The REST examples below illustrate validation of the hotel object.

Runnable · Bash

Paste the entire block into Bash with curl installed. Returns MCP JSON-RPC envelope and HTTP status.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
curl · live hotel rate via MCP
# Requires a permitted HTTP client; these routing headers match the JSON-RPC body.
# Native MCP clients may manage headers; do not omit them without compatibility testing.
# Bash / macOS / Linux. Generate a fresh one-night stay in the future.
# The dates below are generated each run, not hard-coded.
# Capture the hotel's calendar date once, even if the terminal is in another time zone.
BASE_DATE=$(TZ=America/Los_Angeles date +%Y-%m-%d) || exit 1
future_date() {
  # Use UTC only for arithmetic on the already-resolved calendar date.
  date -u -d "$BASE_DATE +$1 days" +%F 2>/dev/null || \
    date -u -j -v+"${1}"d -f "%Y-%m-%d" "$BASE_DATE" +%Y-%m-%d
}
CHECKIN=$(future_date 17) || exit 1
CHECKOUT=$(future_date 18) || exit 1
# Real request example: uncomment BOTH lines and use the dates actually requested.
# CHECKIN=2026-12-14
# CHECKOUT=2026-12-15
# Send these strings unchanged; never add a day or convert them to UTC.
printf "Requested stay: %s to %s | 4 adults | USD\n" "$CHECKIN" "$CHECKOUT" >&2
# For a real search, replace CHECKIN/CHECKOUT with the user's actual dates.
# The unquoted heredoc below expands the two date variables.
# hotelName: full property, city, state/region, country code in one string.
# Wynn Las Vegas = hotel; Las Vegas = city; NV = state; US = country.
# JSON below uses YYYY-MM-DD dates, 4 adults, USD. No inline JSON comments.
# Show returned hotel_name, hotel_address, city_name, state_code, country_code,
# and postal_code as supplied; never guess missing fields.
# Raw diagnostic only: inspect HTTP/tool errors and compare response stay and booking URL
# with CHECKIN/CHECKOUT, 4 adults and USD before quoting the full-stay rate.
curl -sS -H "Accept: application/json, text/event-stream" --max-time 20 -w '\nHTTP %{http_code}\n' -X POST \
  "https://www.businesshotels.com/mcp-server.php" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: test-live-hotel-rates2025" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: tools/call" \
  -H "Mcp-Name: get_live_hotel_rates" \
  --data-binary @- <<JSON
{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "get_live_hotel_rates",
      "arguments": {
        "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
        "checkinDate": "${CHECKIN}",
        "checkoutDate": "${CHECKOUT}",
        "adults": 4,
        "currency": "USD"
      },
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientCapabilities": {},
        "io.modelcontextprotocol/clientInfo": {"name":"example-client","version":"1.0"}
      }
    }
  }
JSON

Existing REST / Function Calling — Still Supported

Live execution endpoint
POST https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates

Public API key — testing & light production use
X-API-KEY: test-live-hotel-rates2025

This published key may be used for development, testing, demonstrations, AI-agent integration, and light production traffic. Current public-key allowance: up to approximately 100 requests per hour. Higher-volume production integrations should use dedicated credentials when available.

cURL (Bash, macOS / Linux)

Runnable · Bash

Paste the entire block into Bash with curl installed. Returns raw REST JSON and HTTP status.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
curl
# Bash / macOS / Linux. Generate a fresh one-night stay in the future.
# The dates below are generated each run, not hard-coded.
# Capture the hotel's calendar date once, even if the terminal is in another time zone.
BASE_DATE=$(TZ=America/Los_Angeles date +%Y-%m-%d) || exit 1
future_date() {
  # Use UTC only for arithmetic on the already-resolved calendar date.
  date -u -d "$BASE_DATE +$1 days" +%F 2>/dev/null || \
    date -u -j -v+"${1}"d -f "%Y-%m-%d" "$BASE_DATE" +%Y-%m-%d
}
CHECKIN=$(future_date 17) || exit 1
CHECKOUT=$(future_date 18) || exit 1
# Real request example: uncomment BOTH lines and use the dates actually requested.
# CHECKIN=2026-12-14
# CHECKOUT=2026-12-15
# Send these strings unchanged; never add a day or convert them to UTC.
printf "Requested stay: %s to %s | 4 adults | USD\n" "$CHECKIN" "$CHECKOUT" >&2
# For a real search, replace CHECKIN/CHECKOUT with the user's actual dates.
# The unquoted heredoc below expands the two date variables.
# hotelName: full property, city, state/region, country code in one string.
# Wynn Las Vegas = hotel; Las Vegas = city; NV = state; US = country.
# JSON below uses YYYY-MM-DD dates, 4 adults, USD. No inline JSON comments.
# Show returned hotel_name, hotel_address, city_name, state_code, country_code,
# and postal_code as supplied; never guess missing fields.
# Raw diagnostic only: inspect HTTP/tool errors and compare response stay and booking URL
# with CHECKIN/CHECKOUT, 4 adults and USD before quoting the full-stay rate.
curl -sS --max-time 20 -w '\nHTTP %{http_code}\n' -X POST \
  "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates" \
  -H "X-API-KEY: test-live-hotel-rates2025" \
  -H "Content-Type: application/json" \
  --data-binary @- <<JSON
{
    "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
    "checkinDate": "${CHECKIN}",
    "checkoutDate": "${CHECKOUT}",
    "adults": 4,
    "currency": "USD"
  }
JSON

Python

Runnable · Python 3

Save as hotel_test.py and run python hotel_test.py (or python3). Python 3.9+ with IANA time-zone data (on systems without it, install tzdata or supply explicit dates). No HTTP package required.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
python
import json
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
import math
import re
from urllib.parse import urlparse, parse_qs
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError  # Python standard library; no pip required

URL = "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates"
HEADERS = {"X-API-KEY": "test-live-hotel-rates2025",
           "Content-Type": "application/json"}
# Demo only: calculate future dates in the hotel’s time zone (Las Vegas).
# For a different destination set its IANA timezone (e.g. Asia/Tokyo).
# For real travel, replace these with the user's destination-local stay dates.
today = datetime.now(ZoneInfo("America/Los_Angeles")).date()
checkin = (today + timedelta(days=17)).isoformat()
checkout = (today + timedelta(days=18)).isoformat()
# Real request example: uncomment BOTH lines and use the dates actually requested.
# checkin = "2026-12-14"
# checkout = "2026-12-15"
# Send these strings unchanged; never add a day or convert them to UTC.
PAYLOAD = {
    # hotelName = exact hotel name, city, optional state/region, country code.
    # International example: Hilton Tokyo, Tokyo, JP. Set the hotel-local timezone above.
    # Wynn Las Vegas (hotel), Las Vegas (city), NV (state), US (country).
    "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
    # Arrival/departure are YYYY-MM-DD strings; replace both with exact traveler dates.
    "checkinDate": checkin,
    "checkoutDate": checkout,
    # Four adults; currency is USD. Use the actual requested values.
    "adults": 4,
    "currency": "USD"
}

def lookup(payload):
    # Reject unsupported occupancy locally; never silently change it.
    if type(payload.get("adults")) is not int or not 1 <= payload["adults"] <= 4:
        raise ValueError("This tool supports 1–4 adults")
    # Explicit dates are calendar strings; validation never shifts them.
    from datetime import date
    dates = [payload[k] for k in ("checkinDate", "checkoutDate")]
    if any(not re.fullmatch(r"\d{4}-\d{2}-\d{2}", d) for d in dates):
        raise ValueError("Use YYYY-MM-DD dates")
    arrival, departure = map(date.fromisoformat, dates)
    if arrival < today or departure <= arrival:
        raise ValueError("Invalid stay dates; use the requested valid dates")
    # HTTP errors and invalid JSON are not evidence of sold-out inventory.
    request = Request(URL, data=json.dumps(payload).encode("utf-8"),
                      headers=HEADERS, method="POST")
    with urlopen(request, timeout=20) as response:
        print("HTTP Status:", response.status)
        data = json.load(response)
    if not isinstance(data, dict):
        raise ValueError("Unexpected response format")
    return data


def interpret(data, payload):
    # Distinguish API errors, match uncertainty, and successful no-rate replies.
    error = data.get("error")
    if error:
        return "api_error"
    if not data.get("hotel_name"):
        return "incomplete"
    # Three fields: property, city, country; four fields: include region.
    # For complex names/addresses retain structured traveler intent separately.
    parts = [part.strip() for part in payload["hotelName"].split(",")]
    if len(parts) not in (3, 4) or not all(parts) or not re.fullmatch(r"[A-Za-z]{2}", parts[-1]):
        return "confirm_identity"
    fields = ("hotel_name", "city_name", "country_code") if len(parts) == 3 else ("hotel_name", "city_name", "state_code", "country_code")
    def geo_key(value):
        return "".join(ch for ch in value.casefold() if ch.isalnum())
    def country_key(value):
        code = value.strip().upper()
        return "GB" if code == "UK" else code
    region_aliases = {"US":{"alabama":"al","alaska":"ak","arizona":"az","arkansas":"ar","california":"ca","colorado":"co","connecticut":"ct","delaware":"de","districtofcolumbia":"dc","florida":"fl","georgia":"ga","hawaii":"hi","idaho":"id","illinois":"il","indiana":"in","iowa":"ia","kansas":"ks","kentucky":"ky","louisiana":"la","maine":"me","maryland":"md","massachusetts":"ma","michigan":"mi","minnesota":"mn","mississippi":"ms","missouri":"mo","montana":"mt","nebraska":"ne","nevada":"nv","newhampshire":"nh","newjersey":"nj","newmexico":"nm","newyork":"ny","northcarolina":"nc","northdakota":"nd","ohio":"oh","oklahoma":"ok","oregon":"or","pennsylvania":"pa","rhodeisland":"ri","southcarolina":"sc","southdakota":"sd","tennessee":"tn","texas":"tx","utah":"ut","vermont":"vt","virginia":"va","washington":"wa","westvirginia":"wv","wisconsin":"wi","wyoming":"wy"},"CA":{"alberta":"ab","britishcolumbia":"bc","manitoba":"mb","newbrunswick":"nb","newfoundlandandlabrador":"nl","novascotia":"ns","northwestterritories":"nt","nunavut":"nu","ontario":"on","princeedwardisland":"pe","quebec":"qc","saskatchewan":"sk","yukon":"yt","québec":"qc"},"AU":{"australiancapitalterritory":"act","newsouthwales":"nsw","northernterritory":"nt","queensland":"qld","southaustralia":"sa","tasmania":"tas","victoria":"vic","westernaustralia":"wa"}}
    def region_key(value, country):
        key = geo_key(value)
        return region_aliases.get(country, {}).get(key, key)
    name_needs_confirmation = False
    for field, value in zip(fields, parts):
        returned = data.get(field)
        if not isinstance(returned, str) or not returned.strip():
            return "confirm_identity"
        if field == "country_code":
            equal = country_key(returned) == country_key(value)
        elif field == "city_name" and country_key(parts[-1]) == "MC" and country_key(str(data.get("country_code", ""))) == "MC":
            equal = geo_key(returned) == geo_key(value) or {geo_key(returned), geo_key(value)} <= {"monaco", "montecarlo"}
        elif field == "state_code":
            equal = region_key(returned, country_key(parts[-1])) == region_key(value, country_key(parts[-1]))
        elif field == "hotel_name":
            name_needs_confirmation = geo_key(returned) != geo_key(value)
            equal = True
        else:
            equal = geo_key(returned) == geo_key(value)
        if not equal:
            return "identity_or_location_mismatch"
    score = data.get("best_match_score")
    if not isinstance(score, (int, float)) or isinstance(score, bool) or not 0 <= score <= 1:
        return "confirm_identity"
    if score < 0.60:
        return "clarify_hotel"
    if score <= 0.85 or name_needs_confirmation:
        return "confirm_identity"
    expected_stay = {"checkin_date": payload["checkinDate"], "checkout_date": payload["checkoutDate"], "adults": payload["adults"], "currency": payload["currency"], "children": 0}
    rates = data.get("rates")
    status = data.get("status")
    if status in ("SUCCESS", "RATE_UNAVAILABLE"):
        actual_stay = data.get("stay")
        if not isinstance(actual_stay, dict) or any(str(actual_stay.get(k)) != str(v) for k, v in expected_stay.items()):
            return "stay_mismatch"
        if data.get("stay_verification") not in ("request_only", "upstream_dates_echoed"):
            return "unverified_stay"
    if status == "RATE_UNAVAILABLE":
        if isinstance(rates, dict) and rates.get("display_all_in_total") == "" and rates.get("ppn_bundle") == "" and rates.get("currency") == payload["currency"] and data.get("booking_page_live_rates") == "":
            return "no_rate"
        return "incomplete"
    if status not in (None, "SUCCESS") or not isinstance(rates, dict) or "display_all_in_total" not in rates:
        return "incomplete"
    raw = rates["display_all_in_total"]
    if raw is None or str(raw).strip() == "":
        return "incomplete"
    # The supplier total is for the entire stay; do not multiply by nights.
    text = str(raw).strip()
    # Validate grouping BEFORE removing commas; 333,56 is ambiguous.
    if not re.fullmatch(r"(?:[0-9]+|[0-9]{1,3}(?:,[0-9]{3})+)(?:\.[0-9]+)?", text):
        return "invalid_price"
    price = float(text.replace(",", ""))
    if not math.isfinite(price) or price <= 0 or rates.get("currency") != payload["currency"]:
        return "invalid_price_or_currency"
    # Validate returned stay and exact booking URL; never rewrite the token.
    stay = data.get("stay")
    if stay is None:
        stay = {}
    if not isinstance(stay, dict):
        return "incomplete"
    link = data.get("booking_page_live_rates")
    if not isinstance(link, str):
        return "incomplete"
    parsed = urlparse(link)
    if parsed.scheme != "https" or parsed.netloc != "www.businesshotels.com" or parsed.path != "/reserve-hotel.php":
        return "invalid_booking_link"
    q = parse_qs(parsed.query, keep_blank_values=True)
    if len(q.get("ppn_bundle", [])) != 1 or not q["ppn_bundle"][0].strip():
        return "invalid_booking_link"
    if not data.get("hotel_id") or q.get("hotel-id") != [str(data["hotel_id"])]:
        return "invalid_booking_link"
    if q.get("USER-COUNTRY") != [data.get("country_code")] or (status == "SUCCESS" and q.get("prid") != ["ai"]):
        return "invalid_booking_link"
    # If supplied separately, the rate token must match the untouched booking link.
    if rates.get("ppn_bundle") is not None and rates["ppn_bundle"] != q["ppn_bundle"][0]:
        return "invalid_booking_link"
    expected = expected_stay
    keys = {"checkin_date":"checkin-date", "checkout_date":"checkout-date", "adults":"NUM-ADULTS", "currency":"USER-CURRENCY", "children":"NUM-CHILDREN"}
    for field, value in expected.items():
        if field in stay and str(stay[field]) != str(value):
            return "stay_mismatch"
        if keys[field] in q and q[keys[field]] != [str(value)]:
            return "stay_mismatch"
        if (status == "SUCCESS" or field != "children") and q.get(keys[field]) != [str(value)]:
            return "unverified_stay"
    return "ok"


def show(data, payload, status):
    # Do not label missing response fields as confirmed or invent a price.
    print("Requested stay:", payload["checkinDate"], "to", payload["checkoutDate"], "·", payload["adults"], "adults ·", payload["currency"])
    print("Status:", status)
    if status == "no_rate":
        print("No bookable rate returned; not proof of sold out.")
    if status != "ok":
        return
    rates = data["rates"]
    # Preserve supplier identity fields exactly; omit unavailable fields.
    for key, label in (("hotel_name", "Hotel"), ("hotel_address", "Address"),
                       ("city_name", "City"), ("state_code", "State/region"),
                       ("country_code", "Country"), ("postal_code", "Postal code")):
        if data.get(key) not in (None, ""):
            print(f"{label}: {data[key]}")
    print("Stay (validated request):", payload["checkinDate"], "to", payload["checkoutDate"], "·", payload["adults"], "adults")
    print("All-in stay total:", rates["display_all_in_total"], rates["currency"])
    if rates.get("price_info"):
        print("Taxes/fees:", rates["price_info"])
    print("Match score:", data["best_match_score"])
    print("Stay verification:", data.get("stay_verification", "not returned"))
    print("Book Now:", data["booking_page_live_rates"])

print("Request:", json.dumps(PAYLOAD))
try:
    data = lookup(PAYLOAD)
    show(data, PAYLOAD, interpret(data, PAYLOAD))
except HTTPError as exc:
    print("HTTP Status:", exc.code)
    try:
        error = json.load(exc)
        print("API error code:", error.get("code", "unknown"))
    except (ValueError, AttributeError):
        print("Invalid error response")
except (URLError, OSError, ValueError, TypeError) as exc:
    print("Request/response error:", exc)

JavaScript / Node.js

Paste the full example into the browser console on BusinessHotels.com. A standalone console.log() evaluates to undefined; that does not mean the API failed. This example returns a structured result object. For Node.js 18+, save the snippet as example.mjs and run node example.mjs. The example prints a status even if no valid rate is returned.

Runnable · Browser / Node.js

Open this page, press F12 → Console, paste the entire block and press Enter. Node.js 18+: save as example.mjs, then run node example.mjs.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
javascript
// Browser console: run on BusinessHotels.com, or save as example.mjs for Node.js 18+.
// The async function returns a result object, not console.log's undefined.
await (async () => {
  const url = "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates";

  // Demo only: calculate a one-night stay 17 days from today (Las Vegas local time).
  // For real searches use the user's actual destination-local dates.
  // Get the calendar date at Wynn Las Vegas, independent of the device time zone.
  // Set this to the hotel-local IANA timezone for other destinations.
  const zone = "America/Los_Angeles";
  const parts = Object.fromEntries(new Intl.DateTimeFormat("en-US", {
    timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit"
  }).formatToParts(new Date()).map(p => [p.type, p.value]));
  // UTC is only an arithmetic container for the local calendar date (not a time conversion).
  const base = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
  const futureDate = days => {
    const d = new Date(base);
    d.setUTCDate(d.getUTCDate() + days);
    return d.toISOString().slice(0, 10);
  };
  // Real request example: replace these two demo values with exact traveler dates.
  let checkin = futureDate(17);
  let checkout = futureDate(18);
  // checkin = "2026-12-14";
  // checkout = "2026-12-15";
  // Send these strings unchanged; never add a day or convert them to UTC.
  const payload = {
    // hotelName = exact hotel name, city, optional state/region, country code.
    // International example: Hilton Tokyo, Tokyo, JP.
    // Wynn Las Vegas (hotel), Las Vegas (city), NV (state), US (country).
    "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
    // Arrival: YYYY-MM-DD; replace with exact traveler date for real searches.
    "checkinDate": checkin,
    // Departure: YYYY-MM-DD after arrival; preserve the traveler’s date.
    "checkoutDate": checkout,
    // Four adults; currency is USD. Use the actual requested values.
    "adults": 4,
    "currency": "USD"
  };
  console.log("Request:", payload);
  // Validate requested values without changing them.
  if (!Number.isInteger(payload.adults) || payload.adults < 1 || payload.adults > 4)
    return {status: "invalid_occupancy", message: "This tool supports 1–4 adults"};
  const validDate = d => /^\d{4}-\d{2}-\d{2}$/.test(d) &&
    Number.isFinite(Date.parse(d)) && new Date(d).toISOString().slice(0, 10) === d;
  if (!validDate(checkin) || !validDate(checkout) || checkout <= checkin || checkin < new Date(base).toISOString().slice(0, 10))
    return {status: "invalid_dates", message: "Use valid requested dates; never shift them"};
  try {
    const response = await fetch(url, {
      method: "POST",
      headers: {"X-API-KEY": "test-live-hotel-rates2025", "Content-Type": "application/json"},
      body: JSON.stringify(payload),
      signal: AbortSignal.timeout(20000)
    });
    // Print the HTTP status before parsing JSON, so even an HTML error is visible.
    console.log("HTTP Status:", response.status);
    const data = await response.json();
    if (!response.ok || !data || typeof data !== "object" || Array.isArray(data))
      return {status: "request_error", http: response.status, code: data?.code ?? null};
    // An API error is not proof that the hotel is sold out.
    if (data.error) return {status: "api_error", code: data.code ?? null};
    const score = data.best_match_score;
    if (!data.hotel_name) return {status: "incomplete"};
    // Three fields (name, city, country), or four including requested region.
    // Complex property names/addresses: retain structured traveler intent separately.
    const identityParts = payload.hotelName.split(",").map(part => part.trim());
    if (![3, 4].includes(identityParts.length) || identityParts.some(v => !v) || !/^[A-Za-z]{2}$/.test(identityParts.at(-1)))
      return {status: "confirm_identity"};
    const identityFields = identityParts.length === 3 ? ["hotel_name", "city_name", "country_code"] : ["hotel_name", "city_name", "state_code", "country_code"];
    const geoKey = value => value.trim().toLowerCase().replace(/[^\p{L}\p{N}]/gu, "");
    const countryKey = value => value.trim().toUpperCase() === "UK" ? "GB" : value.trim().toUpperCase();
    const regionAliases = {"US":{"alabama":"al","alaska":"ak","arizona":"az","arkansas":"ar","california":"ca","colorado":"co","connecticut":"ct","delaware":"de","districtofcolumbia":"dc","florida":"fl","georgia":"ga","hawaii":"hi","idaho":"id","illinois":"il","indiana":"in","iowa":"ia","kansas":"ks","kentucky":"ky","louisiana":"la","maine":"me","maryland":"md","massachusetts":"ma","michigan":"mi","minnesota":"mn","mississippi":"ms","missouri":"mo","montana":"mt","nebraska":"ne","nevada":"nv","newhampshire":"nh","newjersey":"nj","newmexico":"nm","newyork":"ny","northcarolina":"nc","northdakota":"nd","ohio":"oh","oklahoma":"ok","oregon":"or","pennsylvania":"pa","rhodeisland":"ri","southcarolina":"sc","southdakota":"sd","tennessee":"tn","texas":"tx","utah":"ut","vermont":"vt","virginia":"va","washington":"wa","westvirginia":"wv","wisconsin":"wi","wyoming":"wy"},"CA":{"alberta":"ab","britishcolumbia":"bc","manitoba":"mb","newbrunswick":"nb","newfoundlandandlabrador":"nl","novascotia":"ns","northwestterritories":"nt","nunavut":"nu","ontario":"on","princeedwardisland":"pe","quebec":"qc","saskatchewan":"sk","yukon":"yt","québec":"qc"},"AU":{"australiancapitalterritory":"act","newsouthwales":"nsw","northernterritory":"nt","queensland":"qld","southaustralia":"sa","tasmania":"tas","victoria":"vic","westernaustralia":"wa"}};
    const regionKey = (value, country) => regionAliases[country]?.[geoKey(value)] ?? geoKey(value);
    let nameNeedsConfirmation = false;
    for (const [i, field] of identityFields.entries()) {
      const returned = data[field], expected = identityParts[i];
      if (typeof returned !== "string" || !returned.trim()) return {status: "confirm_identity"};
      let equal;
      if (field === "country_code") equal = countryKey(returned) === countryKey(expected);
      else if (field === "city_name" && countryKey(identityParts.at(-1)) === "MC" && countryKey(String(data.country_code ?? "")) === "MC") {
        const a = geoKey(returned), b = geoKey(expected);
        equal = a === b || [a,b].every(v => ["monaco","montecarlo"].includes(v));
      } else if (field === "state_code") equal = regionKey(returned, countryKey(identityParts.at(-1))) === regionKey(expected, countryKey(identityParts.at(-1)));
      else if (field === "hotel_name") { nameNeedsConfirmation = geoKey(returned) !== geoKey(expected); equal = true; }
      else equal = geoKey(returned) === geoKey(expected);
      if (!equal) return {status: "identity_or_location_mismatch"};
    }
    if (typeof score !== "number" || !Number.isFinite(score) || score < 0 || score > 1 || score <= 0.85 || nameNeedsConfirmation)
      return {status: typeof score === "number" && score >= 0 && score < 0.60 ? "clarify_hotel" : "confirm_identity"};
    const expectedStay = {checkin_date: payload.checkinDate, checkout_date: payload.checkoutDate, adults: payload.adults, currency: payload.currency, children: 0};
    if (["SUCCESS", "RATE_UNAVAILABLE"].includes(data.status)) {
      if (!data.stay || typeof data.stay !== "object" || Object.entries(expectedStay).some(([k,v]) => String(data.stay[k]) !== String(v))) return {status: "stay_mismatch"};
      if (!["request_only", "upstream_dates_echoed"].includes(data.stay_verification)) return {status: "unverified_stay"};
    }
    const rates = data.rates;
    if (data.status === "RATE_UNAVAILABLE") {
      return {status: rates?.display_all_in_total === "" && rates?.ppn_bundle === "" && rates?.currency === payload.currency && data.booking_page_live_rates === "" ? "no_rate" : "incomplete"};
    }
    if ((data.status != null && data.status !== "SUCCESS") || !rates || typeof rates !== "object" || !("display_all_in_total" in rates)) return {status: "incomplete"};
    const raw = rates.display_all_in_total;
    if (raw == null || String(raw).trim() === "") return {status: "incomplete"};
    // Parse the full stay total, not a per-night price. Keep returned currency.
    const text = String(raw).trim();
    // Reject ambiguous comma-decimal prices before removing grouping commas.
    if (!/^(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(text)) return {status: "invalid_price_or_currency"};
    const price = Number(text.replace(/,/g, ""));
    if (!Number.isFinite(price) || price <= 0 || rates.currency !== payload.currency)
      return {status: "invalid_price_or_currency"};
    // Verify dates and occupancy against the response and booking URL.
    const stay = data.stay ?? {};
    if (typeof stay !== "object" || Array.isArray(stay)) return {status: "incomplete"};
    if (typeof data.booking_page_live_rates !== "string") return {status: "incomplete"};
    const booking = new URL(data.booking_page_live_rates);
    if (booking.origin !== "https://www.businesshotels.com" || booking.pathname !== "/reserve-hotel.php" || booking.username || booking.password || booking.hash) return {status: "invalid_booking_link"};
    if (booking.searchParams.getAll("ppn_bundle").length !== 1 || !booking.searchParams.get("ppn_bundle")?.trim()) return {status: "invalid_booking_link"};
    if (!data.hotel_id || booking.searchParams.getAll("hotel-id").length !== 1 || booking.searchParams.get("hotel-id") !== String(data.hotel_id)) return {status: "invalid_booking_link"};
    if (booking.searchParams.getAll("USER-COUNTRY").length !== 1 || booking.searchParams.get("USER-COUNTRY") !== data.country_code || (data.status === "SUCCESS" && (booking.searchParams.getAll("prid").length !== 1 || booking.searchParams.get("prid") !== "ai"))) return {status: "invalid_booking_link"};
    // The rate token must match the link if the API supplies both. Never edit either.
    if (rates.ppn_bundle != null && rates.ppn_bundle !== booking.searchParams.get("ppn_bundle"))
      return {status: "invalid_booking_link"};
    const checks = [
      ["checkin_date", "checkin-date", payload.checkinDate],
      ["checkout_date", "checkout-date", payload.checkoutDate],
      ["adults", "NUM-ADULTS", payload.adults],
      ["currency", "USER-CURRENCY", payload.currency],
      ["children", "NUM-CHILDREN", 0]
    ];
    for (const [field, param, expected] of checks) {
      const values = booking.searchParams.getAll(param);
      if ((field in stay && String(stay[field]) !== String(expected)) ||
          (values.length && (values.length !== 1 || values[0] !== String(expected))))
        return {status: "stay_mismatch"};
      if ((data.status === "SUCCESS" || field !== "children") && !values.length)
        return {status: "unverified_stay"};
    }
    // Only now is the price eligible for presentation; a mismatch is not sold out.
    // Present exact API identity fields; do not infer or rewrite location codes.
    const identity = Object.fromEntries(
      ["hotel_name", "hotel_address", "city_name", "state_code", "country_code", "postal_code"]
        .filter(key => data[key] != null && data[key] !== "")
        .map(key => [key, data[key]])
    );
    const result = {
      status: "ok",
      ...identity,
      hotel: data.hotel_name,
      location: [data.hotel_address, data.city_name, data.state_code, data.country_code, data.postal_code].filter(Boolean).join(", "),
      stay: `${payload.checkinDate} → ${payload.checkoutDate} · ${payload.adults} adults`,
      allInTotal: `${rates.display_all_in_total} ${rates.currency}`,
      priceInfo: rates.price_info ?? null,
      matchScore: score,
      stayVerification: data.stay_verification ?? "not returned",
      // Preserve the exact supplier-generated URL; never modify ppn_bundle.
      bookNow: data.booking_page_live_rates
    };
    console.log(result);
    // Return the full object for diagnostics; avoid publishing raw tokens/IP.
    return {...result};
  } catch (error) {
    console.error("Request/response error:", error.message);
    return {status: "request_error", message: error.message};
  }
})().then(result => {
  // Print the outcome even when a rate is unavailable or validation fails.
  console.log("Result status:", result.status);
  if (result.status !== "ok") console.log("Diagnostic result:", result);
  // The console's final value is this object, not console.log's undefined.
  return result;
});

PHP

Runnable · PHP CLI

Save as hotel_test.php, run php hotel_test.php. PHP with the cURL extension is required.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
php
<?php
// CLI: php example.php (requires PHP cURL extension).
$url = "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates";
// Demo only: calculate a future one-night stay (Las Vegas local time).
// For real searches use the user's actual destination-local dates.
// Set the hotel-local IANA timezone for another destination.
$today = new DateTimeImmutable('today', new DateTimeZone('America/Los_Angeles'));
$checkin = $today->modify('+17 days')->format('Y-m-d');
$checkout = $today->modify('+18 days')->format('Y-m-d');
// Real request example: uncomment BOTH lines and use the dates actually requested.
// $checkin = '2026-12-14';
// $checkout = '2026-12-15';
// Send these strings unchanged; never add a day or convert them to UTC.
$payload = [
    // hotelName = exact hotel name, city, optional state/region, country code.
    // International example: Hilton Tokyo, Tokyo, JP.
    // Wynn Las Vegas (hotel), Las Vegas (city), NV (state), US (country).
    "hotelName" => "Wynn Las Vegas, Las Vegas, NV, US",
    // Arrival/departure: YYYY-MM-DD; use the traveler’s exact dates for real searches.
    "checkinDate" => $checkin, "checkoutDate" => $checkout,
    // Four adults; currency is USD. Use the actual requested values.
    "adults" => 4, "currency" => "USD"
];
// Validate occupancy and dates without changing the traveler’s request.
if (!is_int($payload["adults"]) || $payload["adults"] < 1 || $payload["adults"] > 4) exit("This tool supports 1–4 adults\n");
foreach ([$checkin, $checkout] as $d) {
    $parsed = DateTimeImmutable::createFromFormat('!Y-m-d', $d, $today->getTimezone());
    if (!$parsed || $parsed->format('Y-m-d') !== $d) exit("Use valid YYYY-MM-DD dates\n");
}
if ($checkin < $today->format('Y-m-d') || $checkout <= $checkin) exit("Invalid stay dates; never shift requested dates\n");
echo "Request: " . json_encode($payload) . "\n";
// Fail clearly if this PHP installation lacks cURL.
if (!function_exists("curl_init")) exit("Enable the PHP cURL extension first.\n");
$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 20,
    CURLOPT_HTTPHEADER => ["X-API-KEY: test-live-hotel-rates2025", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode($payload)
]);
$body = curl_exec($ch);
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
// Network/HTTP/JSON failure is not sold-out inventory.
if ($body === false || $http < 200 || $http >= 300) {
     $failure = is_string($body) ? json_decode($body, true) : null;
    exit("Request failed (HTTP $http): " . ($failure["code"] ?? $error) . "\n");
}
echo "HTTP Status: $http\n";
$data = json_decode($body, true);
if (!is_array($data) || json_last_error() !== JSON_ERROR_NONE) exit("Invalid JSON\n");
if (!empty($data["error"])) {
    echo "API error code: " . ($data["code"] ?? "unknown") . "\n";
    exit;
}
$score = $data["best_match_score"] ?? null;
if (empty($data["hotel_name"])) exit("Incomplete hotel response\n");
// Three fields (name, city, country), or four including requested region.
// For complex names/addresses retain structured traveler intent separately.
$expectedIdentity = array_map("trim", explode(",", $payload["hotelName"]));
$count = count($expectedIdentity);
if (!in_array($count, [3,4], true) || in_array("", $expectedIdentity, true) || !preg_match('/^[A-Za-z]{2}$/D', $expectedIdentity[$count-1])) exit("Confirm hotel identity\n");
$identityFields = $count === 3 ? ["hotel_name", "city_name", "country_code"] : ["hotel_name", "city_name", "state_code", "country_code"];
$lower = fn($s) => function_exists('mb_strtolower') ? mb_strtolower(trim($s), 'UTF-8') : strtolower(trim($s));
$geoKey = fn($s) => preg_replace('/[^\p{L}\p{N}]+/u', '', $lower($s));
$countryKey = fn($s) => strtoupper(trim($s)) === 'UK' ? 'GB' : strtoupper(trim($s));
$regionAliases = json_decode('{"US":{"alabama":"al","alaska":"ak","arizona":"az","arkansas":"ar","california":"ca","colorado":"co","connecticut":"ct","delaware":"de","districtofcolumbia":"dc","florida":"fl","georgia":"ga","hawaii":"hi","idaho":"id","illinois":"il","indiana":"in","iowa":"ia","kansas":"ks","kentucky":"ky","louisiana":"la","maine":"me","maryland":"md","massachusetts":"ma","michigan":"mi","minnesota":"mn","mississippi":"ms","missouri":"mo","montana":"mt","nebraska":"ne","nevada":"nv","newhampshire":"nh","newjersey":"nj","newmexico":"nm","newyork":"ny","northcarolina":"nc","northdakota":"nd","ohio":"oh","oklahoma":"ok","oregon":"or","pennsylvania":"pa","rhodeisland":"ri","southcarolina":"sc","southdakota":"sd","tennessee":"tn","texas":"tx","utah":"ut","vermont":"vt","virginia":"va","washington":"wa","westvirginia":"wv","wisconsin":"wi","wyoming":"wy"},"CA":{"alberta":"ab","britishcolumbia":"bc","manitoba":"mb","newbrunswick":"nb","newfoundlandandlabrador":"nl","novascotia":"ns","northwestterritories":"nt","nunavut":"nu","ontario":"on","princeedwardisland":"pe","quebec":"qc","saskatchewan":"sk","yukon":"yt","québec":"qc"},"AU":{"australiancapitalterritory":"act","newsouthwales":"nsw","northernterritory":"nt","queensland":"qld","southaustralia":"sa","tasmania":"tas","victoria":"vic","westernaustralia":"wa"}}', true);
$regionKey = fn($s, $country) => $regionAliases[$country][$geoKey($s)] ?? $geoKey($s);
$nameNeedsConfirmation = false;
foreach ($identityFields as $i => $field) {
    $returned = $data[$field] ?? null;
    if (!is_string($returned) || trim($returned) === "") exit("Confirm hotel identity\n");
    $expected = $expectedIdentity[$i];
    if ($field === "country_code") $equal = $countryKey($returned) === $countryKey($expected);
    elseif ($field === "city_name" && $countryKey($expectedIdentity[$count-1]) === "MC" && $countryKey((string)($data['country_code'] ?? '')) === "MC") {
        $a = $geoKey($returned); $b = $geoKey($expected);
        $equal = $a === $b || (in_array($a, ['monaco','montecarlo'], true) && in_array($b, ['monaco','montecarlo'], true));
    } elseif ($field === "state_code") $equal = $regionKey($returned, $countryKey($expectedIdentity[$count-1])) === $regionKey($expected, $countryKey($expectedIdentity[$count-1]));
    elseif ($field === "hotel_name") { $nameNeedsConfirmation = $geoKey($returned) !== $geoKey($expected); $equal = true; }
    else $equal = $geoKey($returned) === $geoKey($expected);
    if (!$equal) exit("Hotel identity or location mismatch\n");
}
if ((!is_int($score) && !is_float($score)) || $score < 0 || $score > 1) exit("Confirm hotel identity: missing/invalid score\n");
if ($score < 0.60) exit("Ask for hotel/city clarification\n");
if ($score <= 0.85 || $nameNeedsConfirmation) exit("Confirm matched hotel identity\n");
$rates = $data["rates"] ?? null;
$status = $data["status"] ?? null;
$expectedStay = ["checkin_date"=>$payload["checkinDate"], "checkout_date"=>$payload["checkoutDate"], "adults"=>$payload["adults"], "currency"=>$payload["currency"], "children"=>0];
if (in_array($status, ["SUCCESS", "RATE_UNAVAILABLE"], true)) {
    if (!is_array($data["stay"] ?? null)) exit("Stay mismatch\n");
    foreach ($expectedStay as $key=>$value) {
        if (!array_key_exists($key, $data["stay"]) || !is_scalar($data["stay"][$key]) || (string)$data["stay"][$key] !== (string)$value) exit("Stay mismatch\n");
    }
    if (!in_array($data["stay_verification"] ?? null, ["request_only", "upstream_dates_echoed"], true)) exit("Unverified stay\n");
}
if ($status === "RATE_UNAVAILABLE") {
    if (is_array($rates) && ($rates["display_all_in_total"] ?? null) === "" && ($rates["ppn_bundle"] ?? null) === "" && ($rates["currency"] ?? null) === $payload["currency"] && ($data["booking_page_live_rates"] ?? null) === "") exit("No rate returned for this stay; not proof of sold out\n");
    exit("Incomplete rate response\n");
}
if (($status !== null && $status !== "SUCCESS") || !is_array($rates) || !array_key_exists("display_all_in_total", $rates)) exit("Incomplete rate response\n");
$raw = $rates["display_all_in_total"];
if ((!is_string($raw) && !is_int($raw) && !is_float($raw)) || trim((string)$raw) === "") exit("Incomplete rate response\n");
// Validate full-stay total and currency; never default a missing currency.
$text = trim((string)$raw);
// Validate grouping before removing commas.
if (!preg_match('/^(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/D', $text)) exit("Invalid price or currency\n");
$price = (float)str_replace(",", "", $text);
if (!is_finite($price) || $price <= 0 || ($rates["currency"] ?? null) !== $payload["currency"]) exit("Invalid price or currency\n");
// Validate occupancy/dates from the stay object and booking URL parameters.
$link = $data["booking_page_live_rates"] ?? "";
$parts = is_string($link) ? parse_url($link) : false;
if (!$parts || ($parts["scheme"] ?? "") !== "https" || ($parts["host"] ?? "") !== "www.businesshotels.com" || ($parts["path"] ?? "") !== "/reserve-hotel.php" || isset($parts["user"], $parts["pass"]) || isset($parts["user"]) || isset($parts["port"]) || isset($parts["fragment"])) exit("Invalid booking link\n");
// Preserve duplicate/empty query values rather than letting parse_str overwrite them.
$q = [];
foreach (explode("&", $parts["query"] ?? "") as $pair) {
    if ($pair === "") continue;
    [$key, $value] = array_pad(explode("=", $pair, 2), 2, "");
    $key = urldecode($key);
    if (array_key_exists($key, $q)) exit("Invalid booking link: duplicate parameter\n");
    $q[$key] = urldecode($value);
}
if (trim($q["ppn_bundle"] ?? "") === "") exit("Invalid booking link\n");
if (empty($data["hotel_id"]) || ($q["hotel-id"] ?? null) !== (string)$data["hotel_id"]) exit("Invalid booking link: hotel mismatch\n");
if (($q["USER-COUNTRY"] ?? null) !== ($data["country_code"] ?? null) || empty($data["country_code"]) || ($status === "SUCCESS" && ($q["prid"] ?? null) !== "ai")) exit("Invalid booking link: country mismatch\n");
$stay = $data["stay"] ?? [];
if (!is_array($stay)) exit("Incomplete stay response\n");
if (isset($rates["ppn_bundle"]) && $rates["ppn_bundle"] !== $q["ppn_bundle"]) exit("Invalid booking link: token mismatch\n");
$checks = [
    ["checkin_date", "checkin-date", $payload["checkinDate"]],
    ["checkout_date", "checkout-date", $payload["checkoutDate"]],
    ["adults", "NUM-ADULTS", $payload["adults"]],
    ["currency", "USER-CURRENCY", $payload["currency"]],
    ["children", "NUM-CHILDREN", 0]
];
foreach ($checks as [$field, $param, $expected]) {
    if ((array_key_exists($field, $stay) && (string)$stay[$field] !== (string)$expected) ||
        (array_key_exists($param, $q) && (!is_scalar($q[$param]) || (string)$q[$param] !== (string)$expected))) exit("Stay mismatch\n");
    if (($status === "SUCCESS" || $field !== "children") && !array_key_exists($param, $q)) exit("Unverified stay\n");
}
// Preserve the actual API field values; omit missing fields rather than guessing.
foreach (["hotel_name" => "Hotel", "hotel_address" => "Address", "city_name" => "City",
          "state_code" => "State/region", "country_code" => "Country", "postal_code" => "Postal code"] as $field => $label) {
    if (isset($data[$field]) && $data[$field] !== "") echo $label . ": " . $data[$field] . "\n";
}
echo "Stay: {$payload['checkinDate']} to {$payload['checkoutDate']} · {$payload['adults']} adults\n";
echo "All-in total: " . (string)$rates["display_all_in_total"] . " " . $rates["currency"] . "\n";
if (!empty($rates["price_info"])) echo "Taxes/fees: " . $rates["price_info"] . "\n";
echo "Match score: $score\n";
echo "Stay verification: " . ($data["stay_verification"] ?? "not returned") . "\n";
// Use this exact URL; never recreate or modify ppn_bundle.
echo "Book Now: $link\n";

AI Agent Prompt

AI agent prompt

Paste into a tool-enabled agent as instructions, not into a terminal. Requires access to MCP or REST.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
ready-to-paste agent instruction
Use the BusinessHotels live hotel-rate tool for named-hotel rates, availability and booking handoff.
Canonical MCP: https://www.businesshotels.com/mcp-server.php
REST: POST https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates
Transport: configure X-API-KEY in the authorized connector/HTTP client; use Content-Type: application/json. Do not put credentials in tool arguments.

Documentation release 2026.11.30.1 · Updated 2026-11-30 · API/server 1.4.4
Execution: use authorized tools/list and tools/call or REST; one named hotel per request. Keep credentials in transport. Preserve hotel-local dates, guests and currency. Verify identity, confidence, stay, positive full-stay total and original booking URL. Never claim sold out or fabricate rates. Preserve link unchanged; verify final dates/terms. For comparisons collect every outcome. Full rules: https://www.businesshotels.com/live-rate-contract.json

Illustrative arguments only (replace dates with exact traveler dates; never reuse sample prices or tokens):
{
  "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
  "checkinDate": "2026-12-14",
  "checkoutDate": "2026-12-15",
  "adults": 4,
  "currency": "USD"
}
Master contract: https://www.businesshotels.com/live-rate-contract.json
Changelog: https://www.businesshotels.com/live-rate-changelog.txt

Example AI Task

AI agent task

Paste into a tool-enabled AI agent. Resolve the date example before making the call.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
natural-language agent example
Use the BusinessHotels live hotel-rate tool for a named hotel. For example, resolve 17 days from today in the hotel-local timezone.
Canonical MCP: https://www.businesshotels.com/mcp-server.php
REST: POST https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates
Transport: configure X-API-KEY in the authorized connector/HTTP client; use Content-Type: application/json. Do not put credentials in tool arguments.

Documentation release 2026.11.30.1 · Updated 2026-11-30 · API/server 1.4.4
Execution: use authorized tools/list and tools/call or REST; one named hotel per request. Keep credentials in transport. Preserve hotel-local dates, guests and currency. Verify identity, confidence, stay, positive full-stay total and original booking URL. Never claim sold out or fabricate rates. Preserve link unchanged; verify final dates/terms. For comparisons collect every outcome. Full rules: https://www.businesshotels.com/live-rate-contract.json

Illustrative arguments only (replace dates with exact traveler dates; never reuse sample prices or tokens):
{
  "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
  "checkinDate": "2026-12-14",
  "checkoutDate": "2026-12-15",
  "adults": 4,
  "currency": "USD"
}
Master contract: https://www.businesshotels.com/live-rate-contract.json
Changelog: https://www.businesshotels.com/live-rate-changelog.txt

🛠️ Model-Agnostic Tool Schema

Use this schema with any large language model or agent framework that supports structured tool or function calling. It intentionally avoids model-version names. This is a generic function definition, not a complete host configuration. Adapt its wrapper to your framework. Optional arguments remain optional; do not enable strict modes that require every property unless you adapt the schema to that host.

Configuration / reference

Use as a function schema in a compatible agent host; adapt its wrapper. JSON does not support code comments.

Dates: Date examples are included in the parameter descriptions; real requests must use actual travel dates.
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
get_live_hotel_rates
{
  "type": "function",
  "name": "get_live_hotel_rates",
  "description": "One named hotel, exact stay dates, supplier-reported full-stay total and original booking URL.",
  "parameters": {
    "type": "object",
    "properties": {
      "hotelName": {
        "type": "string",
        "description": "One property name, city, optional state/region code, two-letter country code in one string. Replace commas within the property name with spaces before joining fields (The Ritz-Carlton Tokyo, Tokyo, JP). Prefer verified region codes (Ontario → ON in CA); omit an unknown region. Never invent geography or send separate geography keys."
      },
      "checkinDate": {
        "type": "string",
        "format": "date",
        "description": "Hotel-local YYYY-MM-DD date only. Preserve explicit traveler dates unchanged; resolve relative dates in destination timezone. Not in past."
      },
      "checkoutDate": {
        "type": "string",
        "format": "date",
        "description": "Hotel-local YYYY-MM-DD date only, strictly after check-in. Preserve explicit traveler dates unchanged."
      },
      "adults": {
        "type": "integer",
        "default": 2,
        "minimum": 1,
        "maximum": 4,
        "description": "Integer 1–4; default 2 only if unspecified. Reject unsupported occupancy before execution; children, ages and room count are not accepted."
      },
      "currency": {
        "type": "string",
        "default": "USD",
        "pattern": "^[A-Z]{3}$",
        "description": "ISO 4217 currency code (USD, EUR, GBP, etc.)."
      }
    },
    "required": [
      "hotelName",
      "checkinDate",
      "checkoutDate"
    ],
    "additionalProperties": false
  }
}
ParameterRequiredLLM instruction
hotelNameYesProperty + city + verified region code (when known) + 2-letter country code, in one string. Replace embedded property-name commas with spaces; never invent geography. Example: The Ritz-Carlton Tokyo, Tokyo, JP.
checkinDateYesDestination-local arrival in YYYY-MM-DD, not in the past. Preserve exact dates; resolve relative dates at the hotel. No UTC conversion.
checkoutDateYesDestination-local departure in YYYY-MM-DD strictly after check-in. A one-night stay ends the next calendar day.
adultsNoDefault 2; documented range 1–4 adults. Children, ages and room count are not exposed here. The separate Finder UI may differ.
currencyNoUppercase 3-letter currency code; default USD.
Rate and response safeguards.

Validate identity, requested stay, currency and original booking URL. request_only permits an otherwise valid quote, but upstream did not echo both dates: verify dates and terms on booking page. upstream_dates_echoed verifies both date echoes only. Reject contradictions. For older results without stay, check URL dates, occupancy and currency. On SUCCESS verify hotel-id, USER-COUNTRY, stay parameters, currency and nonempty ppn_bundle; any separately returned token must match.

Quote only a positive finite full-stay total in returned currency. Validate decimal/grouping before removing commas; reject ambiguous 333,56. RATE_UNAVAILABLE with consistent identity/stay and empty total, token and link means no bookable rate returned, not sold out. Errors/incomplete fields establish no availability. No link for invalid/missing rates. Do not infer room type, cancellation, unlisted charges, expiry or lowest-rate guarantee.

📦 What the LLM Should Read & Return

Illustrative response structure only. The example price is fictitious, dates are fixed for reference, and the redacted booking URL cannot be used. Always request live rates for the traveler’s exact dates.

REST versus MCP: Direct REST returns the hotel object. For MCP JSON-RPC, check the outer error and result.isError first; read the hotel object from result.structuredContent or decode JSON in a tool text content item when present. Some host adapters project fewer fields. If the response is incomplete, do not invent dates, guest counts or scores.
Fictitious response / reference

Read the fields; do not execute this JSON or use its redacted booking link.

Dates: Illustrative dates: 2026-12-14 → 2026-12-15; not a live quote, not a current offer.
Hotel identity: Read hotel_name, hotel_address, city_name, state_code, country_code and postal_code exactly as returned. This is an archived response, not a live quote.
Illustrative REST response · fictitious price · token redacted
{
  "status": "SUCCESS",
  "hotel_id": "700027043",
  "hotel_name": "Wynn Las Vegas",
  "hotel_address": "3131 Las Vegas Blvd. South",
  "city_name": "Las Vegas",
  "state_code": "NV",
  "country_code": "US",
  "postal_code": "89109",
  "stay": {
    "checkin_date": "2026-12-14",
    "checkout_date": "2026-12-15",
    "adults": 4,
    "children": 0,
    "currency": "USD"
  },
  "rates": {
    "display_all_in_total": "325.00",
    "currency": "USD",
    "price_info": "Price includes all tax and fees",
    "ppn_bundle": "REDACTED_EXAMPLE"
  },
  "best_match_score": 1,
  "booking_page_live_rates": "https://www.businesshotels.com/reserve-hotel.php?hotel-id=700027043&ppn_bundle=REDACTED_EXAMPLE&checkin-date=2026-12-14&checkout-date=2026-12-15&language=en&USER-CURRENCY=USD&USER-COUNTRY=US&NUM-ADULTS=4&NUM-CHILDREN=0&prid=ai",
  "agent_presentation": {
    "instruction": "Present hotel, location, stay, live all-in total and booking link together. Never return only the booking link.",
    "primary_price_field": "rates.display_all_in_total",
    "booking_field": "booking_page_live_rates"
  },
  "stay_verification": "request_only",
  "latitude": "",
  "longitude": "",
  "hotel_local_time": {
    "timezone": "America/Los_Angeles",
    "local_date": "2026-11-27",
    "local_time": "21:49:00",
    "utc_offset": "-08:00",
    "local_datetime": "2026-11-27T21:49:00-08:00",
    "source": "city_map"
  }
}
FieldAgent behavior
hotel_namePresent the resolved property name; confirm when match confidence is below the direct-present threshold.
hotel_address / city_name / state_code / country_code / postal_codePresent each supplied field exactly as returned. Omit missing fields or label them not returned; never infer state or country from the request.
statusSUCCESS or RATE_UNAVAILABLE; no-rate is not proof of sold out.
stay_verificationrequest_only: zero or one of the two dates was echoed upstream; stay is requested context, not independent date confirmation. An otherwise valid SUCCESS may be quoted as a supplier-reported total for the requested dates; tell the traveler to verify dates and terms on the booking page. upstream_dates_echoed: both exact dates were echoed, not proof of every stay field or a reservation. Reject any contradiction.
hotel_local_timeHotel-local clock at response generation, not arrival time or proof of stay verification. Source: supplier, city_map (limited verified city/region/country), single_country_zone (one IANA zone), or unknown (all five clock fields null). Offset includes applicable daylight-saving rules. For relative dates use a reliably known hotel-local IANA zone, e.g. America/Los_Angeles for Las Vegas; otherwise ask for exact dates. Never substitute the server/browser date. Before matching, dates past everywhere are rejected; after matching, known hotel-local dates are checked. If the zone is unknown, boundary-day validation is deferred to the live-rate service. A local INVALID_DATES error can include hotel_local_time (REST top level; MCP error.data).
stay.*Validate returned dates, adults, children and currency against request and booking parameters. Current universal responses include stay. For older responses, use booking parameters as request consistency checks, not independent supplier verification.
rates.display_all_in_totalUse as the complete stay total, not a per-night value.
rates.currencyDisplay beside the total.
rates.price_infoReport supplier-provided wording; verify final charges and unlisted fees on the booking page.
booking_page_live_ratesPrimary Book Now CTA. Preserve exactly, but never present it alone when hotel and rate data are available.
best_match_scoreMatching signal only; never overrides an unrelated property or a geographic mismatch. Missing or invalid score requires clarification.
latitude / longitudeUseful for map pins when available. Empty string means unavailable; never convert it to zero.
hotel_idRetain during the session when useful for continuity.

Illustrative no-rate response (HTTP 200)

No bookable rate was returned; this is not evidence of sold-out inventory.

RATE_UNAVAILABLE example
{
  "status": "RATE_UNAVAILABLE",
  "hotel_id": "700027043",
  "hotel_name": "Wynn Las Vegas",
  "hotel_address": "3131 Las Vegas Blvd. South",
  "city_name": "Las Vegas",
  "state_code": "NV",
  "country_code": "US",
  "postal_code": "89109",
  "stay": {
    "checkin_date": "2026-12-14",
    "checkout_date": "2026-12-15",
    "adults": 4,
    "children": 0,
    "currency": "USD"
  },
  "rates": {
    "display_all_in_total": "",
    "currency": "USD",
    "price_info": "No bookable rate returned; the reason is not established.",
    "ppn_bundle": ""
  },
  "best_match_score": 1,
  "booking_page_live_rates": "",
  "agent_presentation": {
    "instruction": "No bookable rate was returned for the requested stay. Do not claim sold out, shift dates or display a booking link.",
    "primary_price_field": "rates.display_all_in_total",
    "booking_field": "booking_page_live_rates"
  },
  "stay_verification": "request_only",
  "latitude": "",
  "longitude": "",
  "hotel_local_time": {
    "timezone": "America/Los_Angeles",
    "local_date": "2026-11-27",
    "local_time": "21:49:00",
    "utc_offset": "-08:00",
    "local_datetime": "2026-11-27T21:49:00-08:00",
    "source": "city_map"
  }
}

🧠 Match Confidence Rules for LLMs

ScoreRequired behavior
> 0.85Only after verifying property identity, geography, stay and rate: present the hotel, all-in total and booking URL.
0.60 – 0.85For a plausible match in the requested location, confirm: “I found [hotel], [street address], [city], [state/region], [country]. Is this the property you mean?” Withhold the rate and booking link until confirmed.
< 0.60Do not present as a reliable match. Ask for hotel name, city, state/region or country details.
Never present an unconfirmed match as verified at or below 0.85, or when the score is missing or invalid. An unrelated property or a conflict with the requested city, state/region, country or address overrides every score. If an error response contains suggestions[], offer only relevant alternatives, clearly labeled and never as the requested hotel. If a hotel name cannot be verified, ask the traveler to confirm it. A deliberately fictional hotel name is a negative test, not a real property or an instruction to find a substitute.

🔁 Multi-Hotel Comparison — Loop, Collect, Then Respond

This API uses a one-hotel-per-request architecture. There is no batch endpoint. To compare multiple properties, call each hotel individually, collect all responses, normalize the all-in totals, and only then present one unified ranked response to the user.

Public API key — testing & light production use:
X-API-KEY: test-live-hotel-rates2025

Current public-key allowance: up to approximately 100 requests/hour.
✅ Correct agentic pattern: Loop → Collect → Validate → Sort → Respond Once
No batch endpoint: do not send a hotels[] array or multiple properties in one payload. The endpoint accepts one hotelName string per request only.

Python — Complete Multi-Hotel Comparison

Runnable · Python 3

Save as compare_hotels.py, run python compare_hotels.py (or python3). Sends one request per hotel. Python 3.9+ with IANA time-zone data (on systems without it, install tzdata or supply explicit dates).

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
python · loop, collect, sort, respond
import json
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
import math
import re
from urllib.parse import urlparse, parse_qs
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError  # Python standard library; no pip required

URL = "https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates"
HEADERS = {"X-API-KEY": "test-live-hotel-rates2025",
           "Content-Type": "application/json"}
# Demo only: calculate future dates in the hotel’s time zone (Las Vegas).
# For a different destination set its IANA timezone (e.g. Asia/Tokyo).
# For real travel, replace these with the user's destination-local stay dates.
today = datetime.now(ZoneInfo("America/Los_Angeles")).date()
checkin = (today + timedelta(days=17)).isoformat()
checkout = (today + timedelta(days=18)).isoformat()
# Real request example: uncomment BOTH lines and use the dates actually requested.
# checkin = "2026-12-14"
# checkout = "2026-12-15"
# Send these strings unchanged; never add a day or convert them to UTC.
PAYLOAD = {
    # hotelName = exact hotel name, city, optional state/region, country code.
    # International example: Hilton Tokyo, Tokyo, JP. Set the hotel-local timezone above.
    # Wynn Las Vegas (hotel), Las Vegas (city), NV (state), US (country).
    "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
    # Arrival/departure are YYYY-MM-DD strings; replace both with exact traveler dates.
    "checkinDate": checkin,
    "checkoutDate": checkout,
    # Four adults; currency is USD. Use the actual requested values.
    "adults": 4,
    "currency": "USD"
}

def lookup(payload):
    # Reject unsupported occupancy locally; never silently change it.
    if type(payload.get("adults")) is not int or not 1 <= payload["adults"] <= 4:
        raise ValueError("This tool supports 1–4 adults")
    # Explicit dates are calendar strings; validation never shifts them.
    from datetime import date
    dates = [payload[k] for k in ("checkinDate", "checkoutDate")]
    if any(not re.fullmatch(r"\d{4}-\d{2}-\d{2}", d) for d in dates):
        raise ValueError("Use YYYY-MM-DD dates")
    arrival, departure = map(date.fromisoformat, dates)
    if arrival < today or departure <= arrival:
        raise ValueError("Invalid stay dates; use the requested valid dates")
    # HTTP errors and invalid JSON are not evidence of sold-out inventory.
    request = Request(URL, data=json.dumps(payload).encode("utf-8"),
                      headers=HEADERS, method="POST")
    with urlopen(request, timeout=20) as response:
        print("HTTP Status:", response.status)
        data = json.load(response)
    if not isinstance(data, dict):
        raise ValueError("Unexpected response format")
    return data


def interpret(data, payload):
    # Distinguish API errors, match uncertainty, and successful no-rate replies.
    error = data.get("error")
    if error:
        return "api_error"
    if not data.get("hotel_name"):
        return "incomplete"
    # Three fields: property, city, country; four fields: include region.
    # For complex names/addresses retain structured traveler intent separately.
    parts = [part.strip() for part in payload["hotelName"].split(",")]
    if len(parts) not in (3, 4) or not all(parts) or not re.fullmatch(r"[A-Za-z]{2}", parts[-1]):
        return "confirm_identity"
    fields = ("hotel_name", "city_name", "country_code") if len(parts) == 3 else ("hotel_name", "city_name", "state_code", "country_code")
    def geo_key(value):
        return "".join(ch for ch in value.casefold() if ch.isalnum())
    def country_key(value):
        code = value.strip().upper()
        return "GB" if code == "UK" else code
    region_aliases = {"US":{"alabama":"al","alaska":"ak","arizona":"az","arkansas":"ar","california":"ca","colorado":"co","connecticut":"ct","delaware":"de","districtofcolumbia":"dc","florida":"fl","georgia":"ga","hawaii":"hi","idaho":"id","illinois":"il","indiana":"in","iowa":"ia","kansas":"ks","kentucky":"ky","louisiana":"la","maine":"me","maryland":"md","massachusetts":"ma","michigan":"mi","minnesota":"mn","mississippi":"ms","missouri":"mo","montana":"mt","nebraska":"ne","nevada":"nv","newhampshire":"nh","newjersey":"nj","newmexico":"nm","newyork":"ny","northcarolina":"nc","northdakota":"nd","ohio":"oh","oklahoma":"ok","oregon":"or","pennsylvania":"pa","rhodeisland":"ri","southcarolina":"sc","southdakota":"sd","tennessee":"tn","texas":"tx","utah":"ut","vermont":"vt","virginia":"va","washington":"wa","westvirginia":"wv","wisconsin":"wi","wyoming":"wy"},"CA":{"alberta":"ab","britishcolumbia":"bc","manitoba":"mb","newbrunswick":"nb","newfoundlandandlabrador":"nl","novascotia":"ns","northwestterritories":"nt","nunavut":"nu","ontario":"on","princeedwardisland":"pe","quebec":"qc","saskatchewan":"sk","yukon":"yt","québec":"qc"},"AU":{"australiancapitalterritory":"act","newsouthwales":"nsw","northernterritory":"nt","queensland":"qld","southaustralia":"sa","tasmania":"tas","victoria":"vic","westernaustralia":"wa"}}
    def region_key(value, country):
        key = geo_key(value)
        return region_aliases.get(country, {}).get(key, key)
    name_needs_confirmation = False
    for field, value in zip(fields, parts):
        returned = data.get(field)
        if not isinstance(returned, str) or not returned.strip():
            return "confirm_identity"
        if field == "country_code":
            equal = country_key(returned) == country_key(value)
        elif field == "city_name" and country_key(parts[-1]) == "MC" and country_key(str(data.get("country_code", ""))) == "MC":
            equal = geo_key(returned) == geo_key(value) or {geo_key(returned), geo_key(value)} <= {"monaco", "montecarlo"}
        elif field == "state_code":
            equal = region_key(returned, country_key(parts[-1])) == region_key(value, country_key(parts[-1]))
        elif field == "hotel_name":
            name_needs_confirmation = geo_key(returned) != geo_key(value)
            equal = True
        else:
            equal = geo_key(returned) == geo_key(value)
        if not equal:
            return "identity_or_location_mismatch"
    score = data.get("best_match_score")
    if not isinstance(score, (int, float)) or isinstance(score, bool) or not 0 <= score <= 1:
        return "confirm_identity"
    if score < 0.60:
        return "clarify_hotel"
    if score <= 0.85 or name_needs_confirmation:
        return "confirm_identity"
    expected_stay = {"checkin_date": payload["checkinDate"], "checkout_date": payload["checkoutDate"], "adults": payload["adults"], "currency": payload["currency"], "children": 0}
    rates = data.get("rates")
    status = data.get("status")
    if status in ("SUCCESS", "RATE_UNAVAILABLE"):
        actual_stay = data.get("stay")
        if not isinstance(actual_stay, dict) or any(str(actual_stay.get(k)) != str(v) for k, v in expected_stay.items()):
            return "stay_mismatch"
        if data.get("stay_verification") not in ("request_only", "upstream_dates_echoed"):
            return "unverified_stay"
    if status == "RATE_UNAVAILABLE":
        if isinstance(rates, dict) and rates.get("display_all_in_total") == "" and rates.get("ppn_bundle") == "" and rates.get("currency") == payload["currency"] and data.get("booking_page_live_rates") == "":
            return "no_rate"
        return "incomplete"
    if status not in (None, "SUCCESS") or not isinstance(rates, dict) or "display_all_in_total" not in rates:
        return "incomplete"
    raw = rates["display_all_in_total"]
    if raw is None or str(raw).strip() == "":
        return "incomplete"
    # The supplier total is for the entire stay; do not multiply by nights.
    text = str(raw).strip()
    # Validate grouping BEFORE removing commas; 333,56 is ambiguous.
    if not re.fullmatch(r"(?:[0-9]+|[0-9]{1,3}(?:,[0-9]{3})+)(?:\.[0-9]+)?", text):
        return "invalid_price"
    price = float(text.replace(",", ""))
    if not math.isfinite(price) or price <= 0 or rates.get("currency") != payload["currency"]:
        return "invalid_price_or_currency"
    # Validate returned stay and exact booking URL; never rewrite the token.
    stay = data.get("stay")
    if stay is None:
        stay = {}
    if not isinstance(stay, dict):
        return "incomplete"
    link = data.get("booking_page_live_rates")
    if not isinstance(link, str):
        return "incomplete"
    parsed = urlparse(link)
    if parsed.scheme != "https" or parsed.netloc != "www.businesshotels.com" or parsed.path != "/reserve-hotel.php":
        return "invalid_booking_link"
    q = parse_qs(parsed.query, keep_blank_values=True)
    if len(q.get("ppn_bundle", [])) != 1 or not q["ppn_bundle"][0].strip():
        return "invalid_booking_link"
    if not data.get("hotel_id") or q.get("hotel-id") != [str(data["hotel_id"])]:
        return "invalid_booking_link"
    if q.get("USER-COUNTRY") != [data.get("country_code")] or (status == "SUCCESS" and q.get("prid") != ["ai"]):
        return "invalid_booking_link"
    # If supplied separately, the rate token must match the untouched booking link.
    if rates.get("ppn_bundle") is not None and rates["ppn_bundle"] != q["ppn_bundle"][0]:
        return "invalid_booking_link"
    expected = expected_stay
    keys = {"checkin_date":"checkin-date", "checkout_date":"checkout-date", "adults":"NUM-ADULTS", "currency":"USER-CURRENCY", "children":"NUM-CHILDREN"}
    for field, value in expected.items():
        if field in stay and str(stay[field]) != str(value):
            return "stay_mismatch"
        if keys[field] in q and q[keys[field]] != [str(value)]:
            return "stay_mismatch"
        if (status == "SUCCESS" or field != "children") and q.get(keys[field]) != [str(value)]:
            return "unverified_stay"
    return "ok"


def show(data, payload, status):
    # Do not label missing response fields as confirmed or invent a price.
    print("Requested stay:", payload["checkinDate"], "to", payload["checkoutDate"], "·", payload["adults"], "adults ·", payload["currency"])
    print("Status:", status)
    if status == "no_rate":
        print("No bookable rate returned; not proof of sold out.")
    if status != "ok":
        return
    rates = data["rates"]
    # Preserve supplier identity fields exactly; omit unavailable fields.
    for key, label in (("hotel_name", "Hotel"), ("hotel_address", "Address"),
                       ("city_name", "City"), ("state_code", "State/region"),
                       ("country_code", "Country"), ("postal_code", "Postal code")):
        if data.get(key) not in (None, ""):
            print(f"{label}: {data[key]}")
    print("Stay (validated request):", payload["checkinDate"], "to", payload["checkoutDate"], "·", payload["adults"], "adults")
    print("All-in stay total:", rates["display_all_in_total"], rates["currency"])
    if rates.get("price_info"):
        print("Taxes/fees:", rates["price_info"])
    print("Match score:", data["best_match_score"])
    print("Stay verification:", data.get("stay_verification", "not returned"))
    print("Book Now:", data["booking_page_live_rates"])

# Same dates, currency and occupancy for every named hotel. No batch endpoint.
hotels = ["Wynn Las Vegas, Las Vegas, NV, US", "Bellagio, Las Vegas, NV, US", "Luxor Las Vegas, Las Vegas, NV, US"]
print("Requested stay:", checkin, "to", checkout, "· 4 adults · USD")
valid, other = [], []
for hotel in hotels:
    payload = {**PAYLOAD, "hotelName": hotel}
    try:
        data = lookup(payload)
        status = interpret(data, payload)
        if status == "ok":
            price = float(str(data["rates"]["display_all_in_total"]).replace(",", ""))
            valid.append((price, data, payload))
        else:
            other.append((hotel, status))
    except (URLError, OSError, ValueError, TypeError) as exc:
        # Continue checking remaining hotels; do not turn failures into sold out.
        other.append((hotel, "request_error"))

# Only comparable, validated rates are sorted. Keep every returned booking link.
for _, data, payload in sorted(valid, key=lambda item: item[0]):
    show(data, payload, "ok")
    print()
for hotel, status in other:
    print(hotel, "—", status)

AI Agent Prompt — Compare Multiple Hotels

AI agent prompt

Paste into a tool-enabled agent. Compare only validated prices using identical dates and occupancy.

Dates: 2026-12-14 → 2026-12-15 (rolling test dates · Las Vegas local time · one night)
Hotel identity: hotelName = Wynn Las Vegas (property), Las Vegas (city), NV (state), US (country). Use one string; omit an unknown region and clarify an unknown country rather than guessing. Display returned identity fields as supplied.
ready-to-paste multi-hotel agent instruction
Compare multiple named hotels; collect every outcome before ranking.
Canonical MCP: https://www.businesshotels.com/mcp-server.php
REST: POST https://www.businesshotels.com/mcp-server.php?route=tools/get_live_hotel_rates
Transport: configure X-API-KEY in the authorized connector/HTTP client; use Content-Type: application/json. Do not put credentials in tool arguments.

Documentation release 2026.11.30.1 · Updated 2026-11-30 · API/server 1.4.4
Execution: use authorized tools/list and tools/call or REST; one named hotel per request. Keep credentials in transport. Preserve hotel-local dates, guests and currency. Verify identity, confidence, stay, positive full-stay total and original booking URL. Never claim sold out or fabricate rates. Preserve link unchanged; verify final dates/terms. For comparisons collect every outcome. Full rules: https://www.businesshotels.com/live-rate-contract.json

Illustrative arguments only (replace dates with exact traveler dates; never reuse sample prices or tokens):
{
  "hotelName": "Wynn Las Vegas, Las Vegas, NV, US",
  "checkinDate": "2026-12-14",
  "checkoutDate": "2026-12-15",
  "adults": 4,
  "currency": "USD"
}
Master contract: https://www.businesshotels.com/live-rate-contract.json
Changelog: https://www.businesshotels.com/live-rate-changelog.txt

Common Agent Workflows

1Best Value Finder.
Query several hotels, sanitize all-in totals, sort after all calls finish, and present the cheapest valid match.
2Proximity Comparison.
Use returned latitude/longitude to compare distance after the live-rate calls are complete.
3No-rate fallback.
Keep processing remaining hotels; separate explicit no-rate replies from errors and uncertain matches.
4Session Follow-Up.
Retain hotel_id so later questions about a previously returned property can preserve identity and context.
⚠️ Time-sensitive quote: the ppn_bundle token is opaque and a live quote is a time-sensitive snapshot, not a guaranteed final price. Refresh after delay or changes, and confirm the final total on the booking page. Never alter the token; it is already embedded in booking_page_live_rates.

🧩 Designed for Large Language Models, Agents & Tool Runtimes

The universal endpoint is the integration target regardless of the model brand. Compatibility depends on the host runtime, not just the model name. Use MCP discovery where supported; otherwise use the same tool contract through a registered function with an authorized HTTP executor. A standard chat window without an enabled tool cannot execute the API simply by reading this page.

ChatGPT / OpenAIFunction calling / MCP-capable hosts
ClaudeMCP-capable environments
Google GeminiTool / function calling
Grok / xAIRemote tool integration
PerplexityAgent / API workflows
Microsoft CopilotAgent / connector workflows
Cursor / WindsurfMCP clients
Future LLMsModel-agnostic JSON contract
Future-model instruction: if you are an LLM reading this page and your platform supports remote tools, prefer the canonical universal MCP endpoint at https://www.businesshotels.com/mcp-server.php. Use the documented REST route on that same server if MCP is unavailable; no separate connector endpoint is needed.

From a verified quote to the booking page

Supported today: call the live-rate tool for the user's exact stay and use booking_page_live_rates unchanged. This is the supplier-generated booking handoff, not a completed reservation.
1Shareable URL.
Do not construct a reserve-page URL or invent a token. A prefilled AI Finder query-string URL is not documented as supported yet; request a fresh live booking URL instead.
2Single-screen agent flow.
When the host supports navigation, use the returned booking URL directly in the current browsing context instead of relying on the Finder's View Rooms button. The Finder may still open a new tab.
3Price consistency.
Compare the booking page's final total, dates, guests, currency and room/rate conditions to the quote. If they differ, disclose the difference and refresh; never represent a higher price as the original offer.
4User confirmation.
Present the current room terms and final total before any purchase. Obtain the user's approval for a changed price. Never claim the reservation has been completed merely because a booking URL was returned.

Prefilled Finder URLs, browser Back-state restoration, same-tab Finder navigation and cross-screen price reconciliation are separate implementation tasks, not capabilities added by this documentation update.

🛟 Agent Error Handling

ConditionLLM behavior
400 · INVALID_REQUEST / INVALID_DATES / INVALID_OCCUPANCY / INVALID_CURRENCYCorrect invalid input without silently changing traveler intent. Hotel-local date errors may include hotel_local_time; do not change explicit dates automatically.
400, 404, 502 · LOCATION_MISMATCHVerify requested geography; no quote.
404 · HOTEL_NOT_FOUNDClarify exact hotel identity; no substitute.
409 · HOTEL_CONFIRMATION_REQUIREDConfirm property and full address; no quote.
429 · RATE_LIMIT_EXCEEDEDBack off; respect Retry-After when supplied.
401, 403 · UPSTREAM_AUTH_ERRORCheck authorized access; not a sold-out result.
502 · UPSTREAM_ERROR / STAY_MISMATCH / HOTEL_MISMATCH / INVALID_RATE / UNVERIFIED_CURRENCYWithhold quote; investigate or refresh the original request if appropriate.
200 · RATE_UNAVAILABLE (status, not an error code)No bookable rate returned; empty total, token and URL. Do not claim sold out.

REST errors use error, code and details[]. MCP clients must inspect transport and tool errors. Network/malformed JSON is not sold-out inventory.

Illustrative validation error (HTTP 400)

{
  "error": "Validation error",
  "code": "INVALID_OCCUPANCY",
  "details": [
    "This tool supports 1 to 4 adults. Do not change the requested guest count."
  ]
}