Skip to main content
Glama
dumyCq

Jinko Hotel Booking MCP Server

by dumyCq

search-hotels

Find available hotels by location coordinates and booking details. Retrieve key hotel information, including name, address, star rating, price range, and room types. Use session_id for additional results beyond the initial 50.

Instructions

Search for available hotels based on location coordinates and booking requirements. This tool returns a paginated list of hotels with their key details including name, address, star rating, price range, and available room types. Each hotel includes summary information about amenities and available rates.

The results are limited to 50 hotels per request. If more results are available, you can retrieve them using the load-more-hotels tool with the returned session_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
adultsNoNumber of adults
check_in_dateNoCheck-in date (YYYY-MM-DD)2025-06-25
check_out_dateNoCheck-out date (YYYY-MM-DD)2025-06-26
childrenNoNumber of children
facilitiesNoFacility IDs to filter hotels by, the IDs can be inferred with facilities resource.
latitudeYesLatitude of the location
longitudeYesLongitude of the location
nameNoOptional location name or hotel name.
search_contextNoA summary of the search context which will be used by the server to better make the recommendation

Implementation Reference

  • The main handler function for the 'search-hotels' tool. It constructs the API request for hotel availability, handles responses, stores hotels in session state, formats summaries, records telemetry metrics, and returns YAML-formatted results with pagination info.
    export async function searchHotels(params: {
      latitude: number;
      longitude: number;
      name?: string;
      check_in_date: string;
      check_out_date: string;
      adults: number;
      children: number;
      facilities?: number[];
    }) {
      const requestBody = {
        check_in_date: params.check_in_date,
        check_out_date: params.check_out_date,
        guests: [
          {
            adults: params.adults,
            children: Array(params.children).fill(8),
            infant: 0,
          },
        ],
        location: {
          latitude: params.latitude.toString(),
          longitude: params.longitude.toString(),
        },
        facility_ids: params.facilities ? params.facilities : [],
        max_results: 50,
      };
    
      // Calculate metrics data
      const nights = calculateNights(params.check_in_date, params.check_out_date);
      const totalTravelers = params.adults + params.children;
      const metrics = getMetrics();
    
      // Make API request to search for hotels
      const availabilityResult = await makeApiRequest<any>(
        "/api/v1/hotels/availability",
        "POST",
        requestBody
      );
    
      if (!availabilityResult) {
        // Record failed search call
        metrics.recordHotelSearchCall({
          location_name: params.name,
          check_in_date: params.check_in_date,
          nights: nights,
          total_travelers: totalTravelers,
          status: 'error'
        });
    
        return createYamlResponse({
          status: "error",
          message: "Failed to retrieve hotel availability data. Please try again later."
        });
      }
    
      const { session_id=null, has_more=false, hotels = [], total = 0 } = availabilityResult;
    
      // Record hotel search metrics
      metrics.recordHotelSearchResults(hotels.length);
      metrics.recordHotelSearchCall({
        location_name: params.name,
        check_in_date: params.check_in_date,
        nights: nights,
        total_travelers: totalTravelers,
        status: hotels.length === 0 ? 'empty' : 'success'
      });
    
      if (hotels.length === 0) {
        return createYamlResponse({
          status: "empty",
          message: "No hotels found matching your criteria. Please try different search parameters."
        });
      }
    
      // Store hotels in session for later retrieval
      hotels.forEach((hotel: Hotel) => {
        session.hotels[hotel.id.toString()] = hotel;
      });
    
      // Format results for response
      const hotelSummaries = hotels.map((hotel: Hotel) => formatHotelToSummaryObject(hotel));
    
      var message = `Found ${hotels.length} available hotels matching the search criteria.`;
      if (has_more) {
        message = message + " Additional hotels are available. If the user needs more options or if the current results don't meet their preferences, use the load-more-hotels tool with the provided session_id to retrieve more options."
      } else {
        message = message + " These are all available hotels matching the search criteria. If the user isn't satisfied with these options, consider suggesting modifications to their search parameters (dates, location, facilities, etc.)."
      }
    
      return createYamlResponse({
        status: "success",
        total_hotels: total,
        hotels: hotelSummaries,
        session_id: session_id,
        message: message,
      });
    }
  • Registers the 'search-hotels' tool with the MCP server, including detailed description, Zod input schema for validation, and the instrumented searchHotels handler function.
    server.tool(
      "search-hotels",
      `Search for available hotels based on location coordinates and booking requirements.
    This tool returns a paginated list of hotels with their key details including name, address, 
    star rating, price range, and available room types. Each hotel includes summary information 
    about amenities and available rates.
    
    The results are limited to 50 hotels per request. If more results are available, you can 
    retrieve them using the load-more-hotels tool with the returned session_id.
    `,
      {
        latitude: z.number().describe("Latitude of the location"),
        longitude: z.number().describe("Longitude of the location"),
        name: z.string().optional().describe("Optional location name or hotel name."),
        check_in_date: z.string().default("2025-06-25").describe("Check-in date (YYYY-MM-DD)"),
        check_out_date: z.string().default("2025-06-26").describe("Check-out date (YYYY-MM-DD)"),
        adults: z.number().min(1).default(2).describe("Number of adults"),
        children: z.number().min(0).default(0).describe("Number of children"),
        search_context: z.string().optional().describe(
          "A summary of the search context which will be used by the server to better make the recommendation"),
        facilities: z.array(z.number()).optional().describe(
          "Facility IDs to filter hotels by, the IDs can be inferred with facilities resource."
        ),
      },
      getTelemetry().telemetryMiddleware.instrumentTool("search-hotels", searchHotels)
    );
  • Zod schema object defining the input parameters and validation rules for the 'search-hotels' tool, including defaults and descriptions.
    {
      latitude: z.number().describe("Latitude of the location"),
      longitude: z.number().describe("Longitude of the location"),
      name: z.string().optional().describe("Optional location name or hotel name."),
      check_in_date: z.string().default("2025-06-25").describe("Check-in date (YYYY-MM-DD)"),
      check_out_date: z.string().default("2025-06-26").describe("Check-out date (YYYY-MM-DD)"),
      adults: z.number().min(1).default(2).describe("Number of adults"),
      children: z.number().min(0).default(0).describe("Number of children"),
      search_context: z.string().optional().describe(
        "A summary of the search context which will be used by the server to better make the recommendation"),
      facilities: z.array(z.number()).optional().describe(
        "Facility IDs to filter hotels by, the IDs can be inferred with facilities resource."
      ),
    },
  • Helper function used by searchHotels to calculate the number of nights between check-in and check-out dates for metrics recording.
    function calculateNights(checkInDate: string, checkOutDate: string): number {
      const checkIn = new Date(checkInDate);
      const checkOut = new Date(checkOutDate);
      const timeDiff = checkOut.getTime() - checkIn.getTime();
      return Math.ceil(timeDiff / (1000 * 3600 * 24));
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: it returns a paginated list (50 hotels per request), includes specific hotel details (name, address, rating, etc.), and mentions a session_id for pagination via 'load-more-hotels'. It does not cover aspects like error handling, rate limits, or authentication needs, but provides substantial operational context beyond basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the first sentence stating the core purpose. Subsequent sentences efficiently add necessary details (returned data, pagination limit, pagination method) without redundancy. Every sentence earns its place by contributing essential information, resulting in zero waste and clear structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (9 parameters, no output schema, no annotations), the description is largely complete. It covers purpose, returned data, pagination behavior, and pagination alternative. However, it lacks details on error cases, authentication, or rate limits, which could be relevant for a search tool with many parameters. The absence of an output schema means the description does not explain return values, but it summarizes key details adequately.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 9 parameters thoroughly (e.g., 'adults' as number of adults, 'check_in_date' in YYYY-MM-DD format). The description adds minimal value beyond the schema, mentioning 'location coordinates and booking requirements' which aligns with parameters like latitude/longitude and check-in/out dates, but does not provide additional syntax, format, or usage details not already in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Search for available hotels') and resource ('hotels'), distinguishing it from siblings like 'book-hotel' (booking), 'find-place' (general places), 'get-facilities' (facility info), 'get-hotel-details' (detailed info), and 'load-more-hotels' (pagination). It specifies the search is based on location coordinates and booking requirements, making the purpose explicit and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (searching hotels with location/booking criteria) and explicitly mentions an alternative ('load-more-hotels' for pagination). However, it does not specify when not to use it (e.g., vs. 'find-place' for non-hotel places or 'get-hotel-details' for detailed info), lacking full exclusions or sibling comparisons beyond pagination.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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