get-facilities
Retrieve facility IDs for hotel amenities like pet-friendly, WiFi, and pools. Use these IDs with the search-hotels tool to filter hotels based on user requirements. Essential for accurate hotel searches.
Instructions
IMPORTANT: ALWAYS USE THIS TOOL FIRST when a user mentions ANY specific hotel amenities or requirements.
This tool must be called BEFORE search-hotels whenever the user mentions requirements like:
Pet-friendly or traveling with pets/dogs/cats
WiFi or internet access
Swimming pools
Parking (free or paid)
Air conditioning or heating
Fitness center or gym
Restaurant or room service
Family rooms
Non-smoking rooms
Any other specific hotel features
The tool returns facility IDs that MUST be used with the search-hotels tool's facilities parameter to properly filter hotels. Without using this tool first, searches will not correctly filter for user-requested amenities.
Example workflow:
User asks for "pet-friendly hotels in Paris"
Call get-facilities to find the facility_id for "Pets allowed"
Use that facility_id in the search-hotels facilities parameter
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Language code for facility names (en, es, it, he, ar, de) | en |
Implementation Reference
- src/hotel-mcp/server/standard.ts:178-212 (handler)The async handler function for the 'get-facilities' tool. Fetches facilities data for the specified language using getFacilitiesByLanguage, parses the JSON response, and returns a formatted success or error message with the facilities list.async (params) => { const lang = params.language || "en"; // Create a mock URL for the getFacilitiesByLanguage function const uri = new URL(`hotel://facilities/${lang}`); const result = await getFacilitiesByLanguage(uri, lang); // Extract the facilities from the result let facilities = []; try { facilities = JSON.parse(result.contents[0].text); } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", message: "Failed to parse facilities data" }) }] }; } return { content: [{ type: "text", text: JSON.stringify({ status: "success", facilities: facilities, message: `Retrieved ${facilities.length} hotel facilities in ${lang} language. IMPORTANT: You MUST identify the facility_id values that match the user's requirements and include them in the facilities parameter of the search-hotels tool. For example, if the user wants pet-friendly hotels, find the facility_id for "Pets allowed" in this list and include it in your search-hotels call.` }) }] }; }
- The Zod input schema for the 'get-facilities' tool defining the optional 'language' parameter.{ language: z.string().default("en").describe("Language code for facility names (en, es, it, he, ar, de)"), },
- src/hotel-mcp/server/standard.ts:150-213 (registration)The server.tool call registering the 'get-facilities' tool, including its name, detailed description instructing usage before searches, input schema, and inline handler implementation.server.tool( "get-facilities", `IMPORTANT: ALWAYS USE THIS TOOL FIRST when a user mentions ANY specific hotel amenities or requirements. This tool must be called BEFORE search-hotels whenever the user mentions requirements like: - Pet-friendly or traveling with pets/dogs/cats - WiFi or internet access - Swimming pools - Parking (free or paid) - Air conditioning or heating - Fitness center or gym - Restaurant or room service - Family rooms - Non-smoking rooms - Any other specific hotel features The tool returns facility IDs that MUST be used with the search-hotels tool's facilities parameter to properly filter hotels. Without using this tool first, searches will not correctly filter for user-requested amenities. Example workflow: 1. User asks for "pet-friendly hotels in Paris" 2. Call get-facilities to find the facility_id for "Pets allowed" 3. Use that facility_id in the search-hotels facilities parameter `, { language: z.string().default("en").describe("Language code for facility names (en, es, it, he, ar, de)"), }, async (params) => { const lang = params.language || "en"; // Create a mock URL for the getFacilitiesByLanguage function const uri = new URL(`hotel://facilities/${lang}`); const result = await getFacilitiesByLanguage(uri, lang); // Extract the facilities from the result let facilities = []; try { facilities = JSON.parse(result.contents[0].text); } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", message: "Failed to parse facilities data" }) }] }; } return { content: [{ type: "text", text: JSON.stringify({ status: "success", facilities: facilities, message: `Retrieved ${facilities.length} hotel facilities in ${lang} language. IMPORTANT: You MUST identify the facility_id values that match the user's requirements and include them in the facilities parameter of the search-hotels tool. For example, if the user wants pet-friendly hotels, find the facility_id for "Pets allowed" in this list and include it in your search-hotels call.` }) }] }; } );
- src/hotel-mcp/utils.ts:14-26 (helper)Helper function loadFacilitiesData that loads the hotel facilities data from facilities.json file, used indirectly by the getFacilitiesByLanguage function called in the tool handler.export function loadFacilitiesData(): any[] { try { if (fs.existsSync(FACILITIES_PATH)) { const data = fs.readFileSync(FACILITIES_PATH, "utf-8"); return JSON.parse(data); } else { console.warn("facilities.json not found at:", FACILITIES_PATH); } } catch (error) { console.error("Error loading facilities data:", error); } return []; // Return empty array on error or if file not found }