search-hotel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

search-hotel

search-hotel

Search hotels using the
travel-cli
. Returns a list of matching hotels with prices, ratings, and the IDs you need to book or look at room options.
使用
travel-cli
搜索酒店。返回匹配的酒店列表,包含价格、评分,以及用于预订或查看房型所需的ID。

When 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
travel-cli
CLI must be available. Run via
npx
:
bash
npx @tvl-justin/travel-cli@latest search-hotel ...
If the user has installed it globally (
npm install -g @tvl-justin/travel-cli
), call
travel-cli
directly.
必须具备
travel-cli
命令行工具。可通过
npx
运行:
bash
npx @tvl-justin/travel-cli@latest search-hotel ...
如果用户已全局安装(
npm install -g @tvl-justin/travel-cli
),可直接调用
travel-cli

How 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 5

Parameter rules

参数规则

  • --location
    (required) — A city, neighborhood, or destination name. Use the most specific one the user gave. If the user only said "Tokyo" use
    "Tokyo"
    ; if they said "Shinjuku, Tokyo" use
    "Shinjuku, Tokyo"
    .
  • --checkin
    /
    --checkout
    (required) —
    YYYY-MM-DD
    format. 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.
  • --rooms
    — Occupancy string. Format:
    • "2"
      = 1 room, 2 adults
    • "2,5"
      = 1 room, 2 adults + 1 child age 5
    • "2,3,8"
      = 1 room, 2 adults + children ages 3 and 8
    • Multiple rooms separated by
      ;
      :
      "2;2,5"
      = room 1 has 2 adults, room 2 has 2 adults + child age 5
    • Default if user doesn't specify:
      "2"
      .
  • --limit
    — How many hotels to return. Default 5. Increase to 10 if the user wants more options.
  • --min-price
    /
    --max-price
    — Price per night in USD. Always convert other currencies to USD before passing. E.g. "under 2 million VND" →
    --max-price 80
    .
  • --filters
    — Comma-separated. Allowed values:
    free_breakfast
    ,
    swimming_pool
    ,
    ocean_view
    ,
    all_inclusive
    . Only include filters the user explicitly asked for.
  • --lat
    /
    --lng
    — Optional coordinates for precision. Use them when you know the coordinates of a well-known city.
  • --location
    (必填)——城市、街区或目的地名称。使用用户提供的最具体名称。如果用户只说“东京”,则使用
    "Tokyo"
    ;如果用户说“东京新宿”,则使用
    "Shinjuku, Tokyo"
  • --checkin
    /
    --checkout
    (必填)——格式为
    YYYY-MM-DD
    。调用前需将相对日期(如下周末、明天)转换为当日日期。如果用户仅提供单个日期和时长(如“5月1日起住3晚”),需计算出退房日期。
  • --rooms
    ——入住人数字符串。格式说明:
    • "2"
      = 1间房,2名成人
    • "2,5"
      = 1间房,2名成人 + 1名5岁儿童
    • "2,3,8"
      = 1间房,2名成人 + 3岁和8岁儿童
    • 多间房用
      ;
      分隔:
      "2;2,5"
      = 第1间房住2名成人,第2间房住2名成人+1名5岁儿童
    • 用户未指定时默认值:
      "2"
  • --limit
    ——返回酒店数量。默认值为5。如果用户需要更多选项,可增加至10。
  • --min-price
    /
    --max-price
    ——每晚价格(美元)。传入前需将其他货币转换为美元。例如“低于200万越南盾”→
    --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
sessionId
. The user will need it for any follow-up call (search-room, book-hotel).
命令行工具会向标准输出打印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"
    }
  ]
}
重要提示 — 保存
sessionId
。用户后续调用(search-room、book-hotel)需要用到它。

Presenting 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:
  1. Park Hyatt Tokyo — $450/night · 9.2/10 · Free cancellation until Apr 29
  2. Hotel Gracery Shinjuku — $180/night · 8.5/10 · Free breakfast
  3. ...
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 (
search-room
skill) or book directly (
book-hotel
skill).
展示清晰易读的列表——包含名称、每晚价格、评分和一项显著特色。请勿直接输出原始JSON。示例:
为您找到5家5月1日至5月5日东京的酒店:
  1. Park Hyatt Tokyo — 450美元/晚 · 9.2/10 · 可免费取消至4月29日
  2. Hotel Gracery Shinjuku — 180美元/晚 · 8.5/10 · 免费早餐
  3. ...
您想要查看其中某家的房型选项,还是直接预订?
始终提供明确的下一步操作:查看房型(
search-room
技能)或直接预订(
book-hotel
技能)。

Common errors

常见错误

  • Network error
    — Travel API unreachable. Tell the user and ask if they want to retry.
  • 400 Bad Request
    — Usually invalid dates (checkout before checkin, dates in the past). Re-validate inputs and re-prompt.
  • No hotels found
    — Try a broader location or different dates.
  • Network error
    — 旅行API无法访问。告知用户并询问是否重试。
  • 400 Bad Request
    — 通常是日期无效(退房早于入住、日期已过期)。重新验证输入并提示用户。
  • No hotels found
    — 尝试扩大搜索范围或更换日期。