Skip to main content
Glama
dumyCq

Jinko Hotel Booking MCP Server

by dumyCq

load-more-hotels

Retrieve the next batch of hotel results from a previous search using the session_id. This tool extends pagination to fetch additional properties with consistent formatting and details, indicating if more data is available.

Instructions

Retrieve additional hotel results from a previous search using the session_id. This tool continues pagination from a previous search-hotels request, returning the next batch of hotels with the same format and details as the original search.

The response format matches search-hotels and includes information about whether further pagination is possible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesSession ID from a previous search-hotels or load-more-hotels response

Implementation Reference

  • The loadMoreHotels function that executes the tool logic: API call to load more hotels by session_id, processes results, stores in session state, formats summaries, constructs response message indicating if more available.
    export async function loadMoreHotels(params: {
      session_id: string;
    }) {
      const metrics = getMetrics();
    
      // Make API request to load more hotels
      const availabilityResult = await makeApiRequest<any>(
        "/api/v1/hotels/availability/load_more",
        "POST",
        { session_id: params.session_id }
      );
    
      if (!availabilityResult) {
        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 results count for load more
      metrics.recordHotelSearchResults(hotels.length);
    
      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 = `Retrieved ${hotels.length} additional hotels matching the search criteria.`;
      if (has_more) {
        message = message + " More hotels are still available. You can continue to load additional options with the load-more-hotels tool if the current selection doesn't satisfy the user's requirements."
      } else {
        message = message + " You have now retrieved all available hotels matching these search criteria. If the user requires more options, suggest modifying their search parameters such as dates, location, or amenity requirements."
      }
    
      return createYamlResponse({
        status: "success",
        total_hotels: total,
        hotels: hotelSummaries,
        session_id: session_id,
        message: message,
      });
    }
  • Registers the 'load-more-hotels' tool with MCP server, including description, input schema, and wraps the handler with telemetry.
    server.tool(
      "load-more-hotels",
      `Retrieve additional hotel results from a previous search using the session_id.
    This tool continues pagination from a previous search-hotels request, returning the next 
    batch of hotels with the same format and details as the original search.
    
    The response format matches search-hotels and includes information about whether 
    further pagination is possible.
    `,
      {
        session_id: z.string().describe("Session ID from a previous search-hotels or load-more-hotels response"),
      },
      getTelemetry().telemetryMiddleware.instrumentTool("load-more-hotels", loadMoreHotels)
    )
  • Zod input schema for the tool: requires session_id string from previous search.
    {
      session_id: z.string().describe("Session ID from a previous search-hotels or load-more-hotels response"),
    },
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