Skip to main content
Glama
dumyCq

Jinko Hotel Booking MCP Server

by dumyCq

book-hotel

Complete hotel bookings by generating a secure payment link. Requires hotel ID, rate ID, and session ID. Displays booking details and payment link for user confirmation.

Instructions

Initiate a hotel booking process for a specific hotel and rate option.

IMPORTANT WORKFLOW:

  1. Before calling this tool, you MUST present a specific hotel's all available rate options to the user using get-hotel-details

  2. The user MUST select a specific rate option they want to book

  3. This tool will generate a secure payment link that the user needs to open in their browser to complete the booking

The response includes a payment_link that must be prominently displayed to the user, along with booking details such as hotel name, check-in/out dates, and total price.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hotel_idYesID of the hotel to book
rate_idYesID of the specific rate option the user has selected
session_idYesThe session ID from a previous search

Implementation Reference

  • The bookHotel function implements the core logic for booking a hotel. It schedules a booking quote via API, polls for status, generates a payment link, and returns formatted booking details or processing status.
    export async function bookHotel(params: { session_id: string, hotel_id: string; rate_id: string }) { // Create quote request const quoteRequest = { products: [ { product_type: "hotel", hotel_id: params.hotel_id, search_session_id: params.session_id, rate_id: params.rate_id, }, ], }; // Schedule quote const scheduleResponse = await makeApiRequest<any>( "/api/v1/booking/quote/schedule", "POST", quoteRequest ); if (!scheduleResponse || !scheduleResponse.reference) { return createYamlResponse({ status: "error", message: "Failed to schedule quote. Please try again later." }); } const quoteId = scheduleResponse.reference; // Poll for quote status const quoteResult = await pollForQuoteStatus(quoteId); // Format quote information const paymentLink = `https://app.jinko.so/checkout/${quoteId}`; if (!quoteResult) { return createYamlResponse({ status: "processing", message: `Your booking request is being processed. Please inform the user that they can proceed to complete their booking using the payment link provided below. The booking details will be finalized during the payment process.`, payment_link: paymentLink, quote_id: quoteId }); } let productInfo = { status: "success", action: "N/A", hotel: "Unknown hotel", check_in: "N/A", check_out: "N/A", total_price: "N/A", payment_link: paymentLink, quote_id: quoteId }; if (quoteResult.quoted_products && quoteResult.quoted_products.length > 0) { const product = quoteResult.quoted_products[0]; productInfo = { status: "success", action: "IMPORTANT: Present the payment_link to the user so they can complete their booking by clicking the link and processing payment.", hotel: product.hotel_name || "Unknown hotel", check_in: product.check_in_date, check_out: product.check_out_date, total_price: `${product.rate_info.selling_price?.amount || "N/A"} ${product.rate_info.selling_price?.currency || "USD"}`, payment_link: paymentLink, quote_id: quoteId }; } return createYamlResponse(productInfo); }
  • Zod input schema defining parameters for the book-hotel tool: session_id, hotel_id, and rate_id.
    { session_id: z.string().describe("The session ID from a previous search"), hotel_id: z.string().describe("ID of the hotel to book"), rate_id: z.string().describe("ID of the specific rate option the user has selected"), },
  • Registration of the 'book-hotel' tool on the MCP server, specifying name, description, input schema, and handler (with telemetry instrumentation).
    server.tool( "book-hotel", `Initiate a hotel booking process for a specific hotel and rate option. IMPORTANT WORKFLOW: 1. Before calling this tool, you MUST present a specific hotel's all available rate options to the user using get-hotel-details 2. The user MUST select a specific rate option they want to book 3. This tool will generate a secure payment link that the user needs to open in their browser to complete the booking The response includes a payment_link that must be prominently displayed to the user, along with booking details such as hotel name, check-in/out dates, and total price. `, { session_id: z.string().describe("The session ID from a previous search"), hotel_id: z.string().describe("ID of the hotel to book"), rate_id: z.string().describe("ID of the specific rate option the user has selected"), }, getTelemetry().telemetryMiddleware.instrumentTool("book-hotel", bookHotel), );

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dumyCq/jinko-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server