Skip to main content
Glama

search_travel_vacancy

Find available hotel rooms on Rakuten Travel using coordinates or hotel number, with filters for dates, price, and number of guests.

Instructions

Search for available hotel rooms on Rakuten Travel by location, date, and price. Requires coordinates (lat/lng) or a hotel number for location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
checkinDateYesCheck-in date (YYYY-MM-DD)
checkoutDateYesCheck-out date (YYYY-MM-DD)
latitudeNoLatitude (WGS84 decimal degrees, e.g., 35.6812)
longitudeNoLongitude (WGS84 decimal degrees, e.g., 139.7671)
searchRadiusNoSearch radius in km (0.1-3, requires lat/lng)
hotelNoNoSpecific Rakuten hotel number (alternative to coordinates)
maxChargeNoMaximum price per night in yen
adultNumNoNumber of adults (1-10)
hitsNoNumber of results

Implementation Reference

  • The async handler function that executes the search_travel_vacancy tool logic: validates location input (coordinates or hotelNo), calls the Rakuten Travel VacantHotelSearch API, and maps the response into a simplified hotel result list.
      async ({ checkinDate, checkoutDate, latitude, longitude, searchRadius, hotelNo, maxCharge, adultNum, hits }) => {
        const hasCoords = latitude !== undefined && longitude !== undefined;
        if (!hasCoords && hotelNo === undefined) {
          return {
            content: [
              {
                type: "text",
                text: "Error: A location is required. Provide either latitude+longitude or hotelNo.",
              },
            ],
          };
        }
        if (hasCoords && hotelNo !== undefined) {
          return {
            content: [
              {
                type: "text",
                text: "Error: Provide either latitude+longitude or hotelNo, not both.",
              },
            ],
          };
        }
    
        const params: Record<string, string> = {
          checkinDate,
          checkoutDate,
          adultNum: String(adultNum),
          hits: String(hits),
        };
        if (hasCoords) {
          params.latitude = String(latitude);
          params.longitude = String(longitude);
          params.datumType = "1"; // WGS84 decimal degrees
        }
        if (hasCoords && searchRadius !== undefined) params.searchRadius = String(searchRadius);
        if (hotelNo !== undefined) params.hotelNo = String(hotelNo);
        if (maxCharge !== undefined) params.maxCharge = String(maxCharge);
    
        const data = (await rakutenRequest(
          ENDPOINTS.travelVacantHotelSearch,
          params
        )) as { hotels?: Array<{ hotel: Array<{ hotelBasicInfo?: Record<string, unknown>; roomInfo?: Array<{ roomBasicInfo?: Record<string, unknown>; dailyCharge?: Record<string, unknown> }> }> }> };
    
        const hotels =
          data.hotels?.map((h) => {
            const basic = h.hotel.find((entry) => entry.hotelBasicInfo)?.hotelBasicInfo ?? {};
            const room = h.hotel.find((entry) => entry.roomInfo)?.roomInfo?.[0];
            return {
              name: basic.hotelName,
              address: `${basic.address1 ?? ""}${basic.address2 ?? ""}`,
              price: room?.dailyCharge?.total ?? basic.hotelMinCharge,
              rating: basic.reviewAverage,
              url: basic.hotelInformationUrl,
              imageUrl: basic.hotelImageUrl,
              roomName: room?.roomBasicInfo?.roomName,
            };
          }) ?? [];
    
        return {
          content: [{ type: "text", text: JSON.stringify(hotels, null, 2) }],
        };
      }
    );
  • Input schema (Zod) definition for the search_travel_vacancy tool: checkinDate, checkoutDate, optional latitude/longitude/searchRadius, optional hotelNo, optional maxCharge, adultNum (default 1), and hits (default 10).
    "Search for available hotel rooms on Rakuten Travel by location, date, and price. Requires coordinates (lat/lng) or a hotel number for location.",
    {
      checkinDate: z.string().describe("Check-in date (YYYY-MM-DD)"),
      checkoutDate: z.string().describe("Check-out date (YYYY-MM-DD)"),
      latitude: z.number().optional().describe("Latitude (WGS84 decimal degrees, e.g., 35.6812)"),
      longitude: z.number().optional().describe("Longitude (WGS84 decimal degrees, e.g., 139.7671)"),
      searchRadius: z
        .number()
        .min(0.1)
        .max(3)
        .optional()
        .describe("Search radius in km (0.1-3, requires lat/lng)"),
      hotelNo: z.number().optional().describe("Specific Rakuten hotel number (alternative to coordinates)"),
      maxCharge: z.number().optional().describe("Maximum price per night in yen"),
      adultNum: z.number().min(1).max(10).default(1).describe("Number of adults (1-10)"),
      hits: z.number().min(1).max(30).default(10).describe("Number of results"),
    },
  • src/index.ts:324-405 (registration)
    Registration of the tool via server.tool('search_travel_vacancy', ...) on the MCP server instance.
    server.tool(
      "search_travel_vacancy",
      "Search for available hotel rooms on Rakuten Travel by location, date, and price. Requires coordinates (lat/lng) or a hotel number for location.",
      {
        checkinDate: z.string().describe("Check-in date (YYYY-MM-DD)"),
        checkoutDate: z.string().describe("Check-out date (YYYY-MM-DD)"),
        latitude: z.number().optional().describe("Latitude (WGS84 decimal degrees, e.g., 35.6812)"),
        longitude: z.number().optional().describe("Longitude (WGS84 decimal degrees, e.g., 139.7671)"),
        searchRadius: z
          .number()
          .min(0.1)
          .max(3)
          .optional()
          .describe("Search radius in km (0.1-3, requires lat/lng)"),
        hotelNo: z.number().optional().describe("Specific Rakuten hotel number (alternative to coordinates)"),
        maxCharge: z.number().optional().describe("Maximum price per night in yen"),
        adultNum: z.number().min(1).max(10).default(1).describe("Number of adults (1-10)"),
        hits: z.number().min(1).max(30).default(10).describe("Number of results"),
      },
      async ({ checkinDate, checkoutDate, latitude, longitude, searchRadius, hotelNo, maxCharge, adultNum, hits }) => {
        const hasCoords = latitude !== undefined && longitude !== undefined;
        if (!hasCoords && hotelNo === undefined) {
          return {
            content: [
              {
                type: "text",
                text: "Error: A location is required. Provide either latitude+longitude or hotelNo.",
              },
            ],
          };
        }
        if (hasCoords && hotelNo !== undefined) {
          return {
            content: [
              {
                type: "text",
                text: "Error: Provide either latitude+longitude or hotelNo, not both.",
              },
            ],
          };
        }
    
        const params: Record<string, string> = {
          checkinDate,
          checkoutDate,
          adultNum: String(adultNum),
          hits: String(hits),
        };
        if (hasCoords) {
          params.latitude = String(latitude);
          params.longitude = String(longitude);
          params.datumType = "1"; // WGS84 decimal degrees
        }
        if (hasCoords && searchRadius !== undefined) params.searchRadius = String(searchRadius);
        if (hotelNo !== undefined) params.hotelNo = String(hotelNo);
        if (maxCharge !== undefined) params.maxCharge = String(maxCharge);
    
        const data = (await rakutenRequest(
          ENDPOINTS.travelVacantHotelSearch,
          params
        )) as { hotels?: Array<{ hotel: Array<{ hotelBasicInfo?: Record<string, unknown>; roomInfo?: Array<{ roomBasicInfo?: Record<string, unknown>; dailyCharge?: Record<string, unknown> }> }> }> };
    
        const hotels =
          data.hotels?.map((h) => {
            const basic = h.hotel.find((entry) => entry.hotelBasicInfo)?.hotelBasicInfo ?? {};
            const room = h.hotel.find((entry) => entry.roomInfo)?.roomInfo?.[0];
            return {
              name: basic.hotelName,
              address: `${basic.address1 ?? ""}${basic.address2 ?? ""}`,
              price: room?.dailyCharge?.total ?? basic.hotelMinCharge,
              rating: basic.reviewAverage,
              url: basic.hotelInformationUrl,
              imageUrl: basic.hotelImageUrl,
              roomName: room?.roomBasicInfo?.roomName,
            };
          }) ?? [];
    
        return {
          content: [{ type: "text", text: JSON.stringify(hotels, null, 2) }],
        };
      }
    );
  • The rakutenRequest helper function used by the tool to make authenticated API calls to Rakuten endpoints.
    async function rakutenRequest(
      endpointUrl: string,
      params: Record<string, string> = {}
    ): Promise<unknown> {
      const appId = getAppId();
      const accessKey = getAccessKey();
      const origin = getOrigin();
      const searchParams = new URLSearchParams({
        applicationId: appId,
        accessKey,
        format: "json",
        ...params,
      });
      const url = `${endpointUrl}?${searchParams}`;
      const res = await fetch(url, {
        headers: {
          Origin: origin,
          Referer: origin,
        },
      });
    
      if (!res.ok) {
        const status = res.status;
        const body = await res.text();
        throw new Error(`Rakuten API error (HTTP ${status}) on ${endpointUrl}: ${body.slice(0, 200)}`);
      }
    
      const text = await res.text();
      if (!text) return { success: true };
      try {
        return JSON.parse(text);
      } catch {
        throw new Error(`Rakuten API returned malformed JSON on ${endpointUrl}`);
      }
    }
Behavior2/5

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

With no annotations, the description carries full burden but only mentions location requirement. It lacks disclosure on response format, pagination, error handling, or authentication needs.

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?

A single 18-word sentence efficiently states purpose and key requirement, with no wasted words.

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

Completeness3/5

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

While purpose is clear and schema covers parameters, the missing output schema and lack of description about return values leave the agent without complete context for a search tool.

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

Parameters4/5

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

Schema covers all parameters (100% coverage), and description adds value by emphasizing the requirement of coordinates or hotel number, which is a constraint not explicitly enforced in 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 tool searches for hotel rooms on Rakuten Travel by location, date, and price, distinguishing it from sibling tools like search_travel which may be broader.

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?

It specifies that location requires coordinates or hotel number, providing clear context. However, it does not explicitly state when not to use this tool versus alternatives like search_travel.

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

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/mrslbt/rakuten-mcp'

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