途牛 CLI 命令列表
一、命令详解
1.1 help - 显示帮助信息
显示 CLI 使用说明,支持按命令、服务或工具查看详情。
用法
bash
tuniu help [command] [server] [tool] [options]参数说明
| 参数 | 说明 |
|---|---|
command | 命令名称(list、call、health、schema、config、auth、update、skill、completion、discovery 等) |
server | 服务名称,如 ticket、hotel、ttms-hotel、flight、intelflight、train、cruise、holiday、package-booking |
tool | 工具名称,如 query_cheapest_tickets、tuniuHotelSearch、searchHolidayList |
选项
| 选项 | 说明 |
|---|---|
-o, --output <format> | 输出格式:text(默认)/ json |
示例
bash
# 显示总览
tuniu help
# 查看 call 命令说明
tuniu help call
# 查看某服务的工具列表
tuniu help ticket
# 查看某工具的参数说明
tuniu help ticket query_cheapest_tickets
tuniu help hotel tuniuHotelSearch1.2 list - 列出服务或工具
列出可用的服务,或指定服务下的工具清单。
用法
bash
tuniu list [server] [options]参数说明
| 参数 | 说明 |
|---|---|
server | 可选。不传则列出所有服务;传入则列出该服务下的工具 |
选项
| 选项 | 说明 |
|---|---|
-o, --output <format> | 输出格式:json(默认)/ table |
-p, --profile <name> | 指定环境 |
示例
bash
# 列出所有服务
tuniu list
# 列出门票服务的工具
tuniu list ticket
# 列出酒店、国内机票、国际机票、火车票、邮轮、度假产品、打包订的工具
tuniu list hotel
tuniu list flight
tuniu list intelflight
tuniu list train
tuniu list cruise
tuniu list holiday
tuniu list package-booking
# 以表格格式输出
tuniu list --output table1.3 call - 调用服务工具
调用指定服务的工具,并传入 JSON 格式参数。
用法
bash
tuniu call <server> <tool> -a '<json>' [options]参数说明
| 参数 | 说明 |
|---|---|
server | 服务名称:ticket、hotel、flight、intelflight、train、cruise、holiday、package-booking |
tool | 工具名称 |
-a, --args <json> | JSON 格式的参数字符串(必填) |
选项
| 选项 | 说明 |
|---|---|
-a, --args <json> | JSON 参数字符串(必填) |
-o, --output <format> | 输出格式:json(默认)/ table |
-p, --profile <name> | 指定环境 |
-t, --timeout <seconds> | 请求超时时间 |
--dry-run | 模拟执行,不实际调用服务 |
示例
bash
# 门票查询
tuniu call ticket query_cheapest_tickets -a '{"scenic_name": "中山陵"}'
# 酒店搜索
tuniu call hotel tuniuHotelSearch -a '{"cityName":"北京","checkIn":"2026-03-01","checkOut":"2026-03-03"}'
# 机票搜索(国内)
tuniu call flight searchLowestPriceFlight -a '{"departureCityName":"北京","arrivalCityName":"上海","departureDate":"2026-03-15"}'
# 国际机票搜索
tuniu call intelflight list_intel_flights -a '{"departure_city":"北京","arrival_city":"东京","departure_date":"2026-08-15","adult_count":1}'
# 火车票搜索
tuniu call train searchLowestPriceTrain -a '{"departureCityName":"南京","arrivalCityName":"上海","departureDate":"2026-03-20"}'
# 邮轮搜索
tuniu call cruise searchCruiseList -a '{"departsDateBegin":"2026-03-17","departsDateEnd":"2026-03-20"}'
# 度假产品搜索
tuniu call holiday searchHolidayList -a '{"keyWord":"三亚","departsDateBegin":"2026-04-10","departsDateEnd":"2026-04-15"}'
# 打包订:创建组合清单(机酒示例)
tuniu call package-booking package_booking_create -a '{"baseInfo":{"startCityName":"南京","destCityName":"北京","departDate":"2026-09-10","returnDate":"2026-09-13","adultCount":1},"resourceSpecs":[{"resourceType":"FLIGHT","flight":{"startCityName":"南京","destCityName":"北京","journeyScope":"ROUND_TRIP","cabinType":"ECONOMY","internationalFlag":"DOMESTIC"}},{"resourceType":"HOTEL","hotel":{"day":[1,2,3],"destCityName":"北京"}}]}'
# 模拟执行(不实际调用)
tuniu call ticket query_cheapest_tickets -a '{"scenic_name":"故宫"}' --dry-run1.4 health - 健康检查
检查 MCP 服务的连通性与健康状态。
用法
bash
tuniu health [server] [options]参数说明
| 参数 | 说明 |
|---|---|
server | 可选。不传则检查默认服务;传入则检查指定服务 |
选项
| 选项 | 说明 |
|---|---|
--parallel | 并行检查所有服务 |
-o, --output <format> | 输出格式:json(默认)/ table |
-p, --profile <name> | 指定环境 |
示例
bash
# 健康检查(默认服务)
tuniu health
# 检查指定服务
tuniu health ticket
tuniu health hotel
tuniu health flight
tuniu health intelflight
tuniu health train
tuniu health cruise
tuniu health holiday
tuniu health package-booking
# 并行检查所有服务
tuniu health --parallel1.5 schema - 导出工具 Schema
导出工具的能力定义(Schema),供 Agent 或自动化脚本初始化时使用。
用法
bash
tuniu schema [server] [options]参数说明
| 参数 | 说明 |
|---|---|
server | 可选。不传则导出所有服务;传入则仅导出该服务 |
选项
| 选项 | 说明 |
|---|---|
-o, --output <format> | 输出格式:json(默认)/ markdown |
-p, --profile <name> | 指定环境 |
示例
bash
# 导出所有服务的 Schema
tuniu schema
# 导出指定服务的 Schema
tuniu schema ticket
tuniu schema hotel
tuniu schema flight
tuniu schema intelflight
tuniu schema train
tuniu schema cruise
tuniu schema holiday
tuniu schema package-booking
# 以 Markdown 格式输出
tuniu schema --output markdown1.6 config - 配置管理
管理 CLI 配置文件(~/.tuniu-mcp/config.json)。
用法
bash
tuniu config <action> [key] [value] [options]子命令
| action | 说明 |
|---|---|
init | 初始化配置文件,若不存在则创建 |
show | 显示当前加载的配置内容 |
set | 设置配置项(当前支持 defaultProfile) |
选项
| 选项 | 说明 |
|---|---|
-p, --profile <name> | 指定环境 |
-f, --force | 仅 init 时有效,覆盖已有配置文件 |
示例
bash
# 初始化配置(首次使用前执行)
tuniu config init
# 覆盖已有配置(如环境变量更名后需更新模板)
tuniu config init --force
# 查看当前配置
tuniu config show
# 设置默认 profile
tuniu config set defaultProfile production1.7 auth - OAuth 认证管理
管理 OAuth 登录、授权状态和本地授权信息。首次使用推荐先完成 OAuth 授权。
用法
bash
tuniu auth login [options]
tuniu auth status [options]
tuniu auth logout [options]子命令
| 子命令 | 说明 |
|---|---|
login | 通过浏览器完成 OAuth 授权,并保存当前 profile 的授权信息 |
status | 查看当前 profile 的 OAuth 授权状态 |
logout | 删除当前 profile 下保存的 OAuth 授权信息 |
callback-worker | 内部 callback worker,一般无需手动调用 |
选项
| 选项 | 适用命令 | 说明 |
|---|---|---|
-p, --profile <name> | 全部 | 指定环境配置 |
--port <port> | login | 指定本地 OAuth callback 端口 |
--no-browser | login | 只输出授权 URL,不自动打开浏览器 |
--daemon | login / status / logout | Agent 集成模式;登录时输出授权 URL 后由后台 worker 监听回调 |
示例
bash
# 登录并授权
tuniu auth login
# 不自动打开浏览器,手动访问输出的 URL
tuniu auth login --no-browser
# WorkBuddy 等 Agent 环境
tuniu auth login --daemon
tuniu auth status --daemon
# 查看或清除授权状态
tuniu auth status
tuniu auth logout1.8 update - 更新 CLI
一键检查并升级 tuniu-cli,默认同时刷新本机已安装的 Agent Skill。
用法
bash
tuniu update [options]选项
| 选项 | 说明 |
|---|---|
--check | 仅检查是否有新版本,不安装 |
--cli-only | 只更新 CLI,不刷新 Skill |
--to <version> | 更新到指定版本(默认 npm latest) |
-o, --output <format> | 输出格式:json(默认)/ text |
-p, --profile <name> | 环境配置(影响 Skill 下载地址) |
说明
- 查询 npm registry 最新版本后执行
npm install -g tuniu-cli@<version>。 - 安装前清理全局
node_modules下的.tuniu-cli-*残留临时目录;遇ENOTEMPTY时自动卸载后重装。 - 默认刷新本机已经安装过的 Agent Skill;未装过的 Agent 不会新建。
- 仅刷新 Skill(不升级 CLI)请用
tuniu skill install。 - 源码 /
npm link/npx场景无法原地全局升级,会返回明确失败提示。
示例
bash
tuniu update --check
tuniu update
tuniu update --cli-only
tuniu update --to 1.1.2成功时会提示类似:
text
tuniu-cli 1.1.0 版本更新至 1.1.1 版本,以下 agent 内 tuniu-cli skill 已同步更新:cursor、codex,如需更新其他 agent 内 skill,请执行 tuniu skill install --dir <skills根目录>。1.9 skill - Skill 管理
安装 skill 到 Agent 目录,或查看已安装的版本信息。
子命令
| 子命令 | 说明 |
|---|---|
install | 安装 skill 到指定 Agent 目录 |
version | 查看已安装的 skill 版本信息 |
用法
bash
tuniu skill install [agent] [options]
tuniu skill version选项(install)
| 选项 | 说明 |
|---|---|
-a, --agent <names> | 指定目标 Agent,逗号分隔(或 all),支持:agents,claude,cursor,qoder,codex,opencode,openclaw,copaw,workbuddy;all 仅安装到本机已存在父目录的 Agent |
--dir <path> | 额外安装到指定 skills 根目录 |
-f, --force | 覆盖已存在的 Skill 文件 |
说明
- 优先从途牛开放平台下载最新 skill,失败则使用内置文件
- npm 全局安装(
npm install -g tuniu-cli@latest)通常会通过postinstall自动注册 Skill;本命令主要用于手动安装/更新或定向安装。 - 默认(不传
agent/--agent)仅安装到~/.agents/skills/tuniu-cli/。 - 如需安装到指定内置 Agent,可用位置参数或
--agent。 - 对于未内置适配的 Agent,请使用
--dir指定技能目录。
示例
bash
# 默认安装到 ~/.agents/skills/tuniu-cli/
tuniu skill install
# 位置参数:单个 Agent
tuniu skill install claude
# 只安装到 Cursor 和 Claude
tuniu skill install --agent cursor,claude
# 安装到全部支持的 Agent 目录
tuniu skill install --agent all
# 额外安装到自定义目录
tuniu skill install --dir ~/.custom-agent/skills
# 查看已安装的 skill 版本
tuniu skill version1.10 completion - Shell 补全
生成 Bash、Zsh、Fish 的补全脚本,支持自动安装与卸载。
用法
bash
tuniu completion <shell> [options]参数说明
| 参数 | 说明 |
|---|---|
shell | shell 类型:bash、zsh、fish |
选项
| 选项 | 说明 |
|---|---|
--install | 自动安装补全脚本到 Shell 配置 |
--uninstall | 卸载补全脚本 |
示例
bash
# 输出补全脚本(可重定向到文件)
tuniu completion bash
tuniu completion zsh
tuniu completion fish
# 自动安装
tuniu completion bash --install
tuniu completion zsh --install
tuniu completion fish --install
# 卸载
tuniu completion bash --uninstall
tuniu completion zsh --uninstall
tuniu completion fish --uninstall1.11 discovery - 服务发现管理
管理与查看服务发现状态及缓存(子命令)。
子命令
| 子命令 | 说明 |
|---|---|
refresh | 刷新服务列表缓存 |
status | 显示服务发现状态 |
list | 列出已发现的服务 |
discovery refresh - 刷新服务列表缓存
bash
tuniu discovery refreshdiscovery status - 显示服务发现状态
bash
tuniu discovery statusdiscovery list - 列出已发现的服务
bash
# 列出已发现的服务
tuniu discovery list
# 显示所有服务(包括 offline)
tuniu discovery list --all
# 指定输出格式
tuniu discovery list -o json| 选项 | 说明 |
|---|---|
-a, --all | 显示所有服务(包括 offline) |
-o, --output <format> | 输出格式:json |
二、全局选项
可在命令后添加以下选项:
| 选项 | 短选项 | 说明 | 示例 |
|---|---|---|---|
--detail | -d | 调试模式,打印完整请求/响应 | tuniu call ... -d |
--output | -o | 输出格式:json/table/yaml | tuniu list -o table |
--profile | -p | 环境配置(默认 production) | tuniu list -p development |
--config | -c | 指定配置文件路径 | tuniu config show -c ./config.json |
--timeout | -t | 设置请求超时时间(秒) | tuniu call ... -t 60 |
--version | -V | 显示版本号 | tuniu -V |
三、服务与工具速查
| 服务 | 功能 | 可用工具 | 详细说明 |
|---|---|---|---|
ticket | 景点门票查询与预订,支持查询票型价格并在线下单 | query_cheapest_tickets(门票查询)create_ticket_order(创建订单) | 门票服务 |
hotel | 酒店搜索、详情查询与在线预订,支持城市/日期/关键词筛选 | tuniuHotelSearch(酒店搜索)tuniuHotelDetail(酒店详情)tuniuHotelCreateOrder(创建订单) | 酒店服务 |
flight | 国内航班搜索与预订,支持低价/时段/价格区间等 6 种查询模式 | searchLowestPriceFlight(航班搜索)multiCabinDetails(舱位查询)getBookingRequiredInfo(预订信息)saveOrder(创建订单)cancelOrder(取消订单) | 机票服务 |
intelflight | 国际航班搜索与预订(含港澳台航线),支持直飞/中转、多舱位详情与护照乘客下单 | list_intel_flights(国际航班搜索)get_intel_flight_details(舱位详情)getBookingRequiredInfo(预订信息)create_intel_flight_order(创建订单)cancel_intel_flight_order(取消订单) | 国际机票服务 |
train | 火车票车次查询与预订,支持搜索车次列表并在线下单 | searchLowestPriceTrain(查询车次)queryTrainDetail(车次详情)bookTrain(预订下单)queryTrainOrderDetail(订单详情)cancelOrder(取消订单) | 火车票服务 |
cruise | 邮轮产品搜索与预订,支持按日期/航线/品牌筛选,兼容"游轮"说法 | searchCruiseList(邮轮搜索)getCruiseProductDetail(产品详情)getCruiseBookingRequiredInfo(预订信息)saveCruiseOrder(创建订单) | 邮轮服务 |
holiday | 度假产品搜索与预订,支持目的地/出游日期/品类筛选,兼容跟团、自助游、自驾游、当地游等表述 | searchHolidayList(度假列表搜索)getHolidayProductDetail(产品详情与团期日历)getHolidayBookingRequiredInfo(预订说明)saveHolidayOrder(创建订单) | 度假服务 |
package-booking | 打包订:将机票/火车/酒店/门票中至少两类组合成带报价清单,确认后再提交订单 | package_booking_create(创建组合清单)package_booking_submit(提交订单) | 打包订服务 |
详细工具参数请参考各服务文档或使用
tuniu help <server> <tool>查看。
