search-hotel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesesearch-hotel
search-hotel
Search hotels using the . Returns a list of matching hotels with prices, ratings, and the IDs you need to book or look at room options.
travel-cli使用搜索酒店。返回匹配的酒店列表,包含价格、评分,以及用于预订或查看房型所需的ID。
travel-cliWhen to use
使用场景
Trigger this skill when the user wants to find accommodation. Examples:
- "Find me a hotel in Tokyo from May 1 to May 5"
- "Show me 4-star hotels in Paris with ocean view"
- "Where can I stay near Shibuya next weekend"
- "I need a place for 2 adults and 1 child in Bangkok"
Do NOT use this skill for flights, tours, restaurants, or non-accommodation travel queries.
当用户需要寻找住宿时触发此技能。示例:
- “帮我找5月1日至5月5日东京的酒店”
- “给我展示巴黎带海景的四星级酒店”
- “下周末我可以在涩谷附近住哪里”
- “我需要曼谷能容纳2名成人和1名儿童的住宿”
请勿将此技能用于机票、旅游团、餐厅或非住宿类旅行查询。
Prerequisites
前提条件
The CLI must be available. Run via :
travel-clinpxbash
npx @tvl-justin/travel-cli@latest search-hotel ...If the user has installed it globally (), call directly.
npm install -g @tvl-justin/travel-clitravel-cli必须具备命令行工具。可通过运行:
travel-clinpxbash
npx @tvl-justin/travel-cli@latest search-hotel ...如果用户已全局安装(),可直接调用。
npm install -g @tvl-justin/travel-clitravel-cliHow to call
调用方式
The full command:
bash
npx @tvl-justin/travel-cli@latest search-hotel \
--location "<city or destination>" \
--checkin <YYYY-MM-DD> \
--checkout <YYYY-MM-DD> \
--rooms "<occupancy>" \
--limit 5完整命令:
bash
npx @tvl-justin/travel-cli@latest search-hotel \
--location "<city or destination>" \
--checkin <YYYY-MM-DD> \
--checkout <YYYY-MM-DD> \
--rooms "<occupancy>" \
--limit 5Parameter rules
参数规则
- (required) — A city, neighborhood, or destination name. Use the most specific one the user gave. If the user only said "Tokyo" use
--location; if they said "Shinjuku, Tokyo" use"Tokyo"."Shinjuku, Tokyo" - /
--checkin(required) —--checkoutformat. Resolve relative dates ("next weekend", "tomorrow") against today's date before calling. If the user only gave a single date and a duration ("3 nights from May 1"), compute the checkout date.YYYY-MM-DD - — Occupancy string. Format:
--rooms- = 1 room, 2 adults
"2" - = 1 room, 2 adults + 1 child age 5
"2,5" - = 1 room, 2 adults + children ages 3 and 8
"2,3,8" - Multiple rooms separated by :
;= room 1 has 2 adults, room 2 has 2 adults + child age 5"2;2,5" - Default if user doesn't specify: .
"2"
- — How many hotels to return. Default 5. Increase to 10 if the user wants more options.
--limit - /
--min-price— Price per night in USD. Always convert other currencies to USD before passing. E.g. "under 2 million VND" →--max-price.--max-price 80 - — Comma-separated. Allowed values:
--filters,free_breakfast,swimming_pool,ocean_view. Only include filters the user explicitly asked for.all_inclusive - /
--lat— Optional coordinates for precision. Use them when you know the coordinates of a well-known city.--lng
- (必填)——城市、街区或目的地名称。使用用户提供的最具体名称。如果用户只说“东京”,则使用
--location;如果用户说“东京新宿”,则使用"Tokyo"。"Shinjuku, Tokyo" - /
--checkin(必填)——格式为--checkout。调用前需将相对日期(如下周末、明天)转换为当日日期。如果用户仅提供单个日期和时长(如“5月1日起住3晚”),需计算出退房日期。YYYY-MM-DD - ——入住人数字符串。格式说明:
--rooms- = 1间房,2名成人
"2" - = 1间房,2名成人 + 1名5岁儿童
"2,5" - = 1间房,2名成人 + 3岁和8岁儿童
"2,3,8" - 多间房用分隔:
;= 第1间房住2名成人,第2间房住2名成人+1名5岁儿童"2;2,5" - 用户未指定时默认值:。
"2"
- ——返回酒店数量。默认值为5。如果用户需要更多选项,可增加至10。
--limit - /
--min-price——每晚价格(美元)。传入前需将其他货币转换为美元。例如“低于200万越南盾”→--max-price。--max-price 80 - ——逗号分隔的筛选条件。允许的值:
--filters,free_breakfast,swimming_pool,ocean_view。仅包含用户明确要求的筛选条件。all_inclusive - /
--lat——可选的精确坐标。当你知道知名城市的坐标时使用。--lng
Asking for missing info
询问缺失信息
If the user gave a destination but not the dates, ask once for both check-in and check-out (or check-in plus duration). Don't ask for occupancy unless the question implies a non-default party (e.g. "for my family of 4").
如果用户提供了目的地但未给出日期,需一次性询问入住和退房日期(或入住日期加时长)。除非用户的问题暗示非默认入住人数(如“我一家4口需要住宿”),否则无需询问入住人数。
Output
输出
The CLI prints JSON to stdout:
json
{
"sessionId": "abc123",
"hotels": [
{
"hotelId": "h_001",
"name": "Park Hyatt Tokyo",
"rating": 9.2,
"star": 5,
"pricePerNight": 450,
"totalPrice": 1800,
"currency": "USD",
"packageId": "pkg_001",
"refundability": "free_cancellation_until_2026-04-29"
}
]
}Important — Save the . The user will need it for any follow-up call (search-room, book-hotel).
sessionId命令行工具会向标准输出打印JSON:
json
{
"sessionId": "abc123",
"hotels": [
{
"hotelId": "h_001",
"name": "Park Hyatt Tokyo",
"rating": 9.2,
"star": 5,
"pricePerNight": 450,
"totalPrice": 1800,
"currency": "USD",
"packageId": "pkg_001",
"refundability": "free_cancellation_until_2026-04-29"
}
]
}重要提示 — 保存。用户后续调用(search-room、book-hotel)需要用到它。
sessionIdPresenting results to the user
向用户展示结果
Show a clean, scannable list — name, price/night, rating, and one notable feature. Don't dump the raw JSON. Example:
Found 5 hotels in Tokyo for May 1–5:
- Park Hyatt Tokyo — $450/night · 9.2/10 · Free cancellation until Apr 29
- Hotel Gracery Shinjuku — $180/night · 8.5/10 · Free breakfast
- ...
Want to see room options for any of these, or shall I go ahead and book one?
Always offer a clear next step: see rooms ( skill) or book directly ( skill).
search-roombook-hotel展示清晰易读的列表——包含名称、每晚价格、评分和一项显著特色。请勿直接输出原始JSON。示例:
为您找到5家5月1日至5月5日东京的酒店:
- Park Hyatt Tokyo — 450美元/晚 · 9.2/10 · 可免费取消至4月29日
- Hotel Gracery Shinjuku — 180美元/晚 · 8.5/10 · 免费早餐
- ...
您想要查看其中某家的房型选项,还是直接预订?
始终提供明确的下一步操作:查看房型(技能)或直接预订(技能)。
search-roombook-hotelCommon errors
常见错误
- — Travel API unreachable. Tell the user and ask if they want to retry.
Network error - — Usually invalid dates (checkout before checkin, dates in the past). Re-validate inputs and re-prompt.
400 Bad Request - — Try a broader location or different dates.
No hotels found
- — 旅行API无法访问。告知用户并询问是否重试。
Network error - — 通常是日期无效(退房早于入住、日期已过期)。重新验证输入并提示用户。
400 Bad Request - — 尝试扩大搜索范围或更换日期。
No hotels found