途牛 CLI 命令列表
一、命令详解
1.1 help - 显示帮助信息
显示 CLI 使用说明,支持按命令、服务或工具查看详情。
用法
bash
tuniu help [command] [server] [tool] [options]参数说明
| 参数 | 说明 |
|---|---|
command | 命令名称(list、call、health、schema、config、completion 等) |
server | 服务名称,如 ticket、hotel、flight、train、cruise、holiday |
tool | 工具名称,如 query_cheapest_tickets、tuniu_hotel_search、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 tuniu_hotel_search1.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 train
tuniu list cruise
tuniu list holiday
# 以表格格式输出
tuniu list --output table1.3 call - 调用服务工具
调用指定服务的工具,并传入 JSON 格式参数。
用法
bash
tuniu call <server> <tool> -a '<json>' [options]参数说明
| 参数 | 说明 |
|---|---|
server | 服务名称:ticket、hotel、flight、train、cruise、holiday |
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 tuniu_hotel_search -a '{"cityName":"北京","checkIn":"2026-03-01","checkOut":"2026-03-03"}'
# 机票搜索
tuniu call flight searchLowestPriceFlight -a '{"departureCityName":"北京","arrivalCityName":"上海","departureDate":"2026-03-15"}'
# 火车票搜索
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 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 train
tuniu health cruise
tuniu health holiday
# 并行检查所有服务
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 train
tuniu schema cruise
tuniu schema holiday
# 以 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 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 |
--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.8 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.9 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 | 酒店搜索、详情查询与在线预订,支持城市/日期/关键词筛选 | tuniu_hotel_search(酒店搜索)tuniu_hotel_detail(酒店详情)tuniu_hotel_create_order(创建订单) | 酒店服务 |
flight | 国内航班搜索与预订,支持低价/时段/价格区间等 6 种查询模式 | searchLowestPriceFlight(航班搜索)multiCabinDetails(舱位查询)getBookingRequiredInfo(预订信息)saveOrder(创建订单)cancelOrder(取消订单) | 机票服务 |
train | 火车票车次查询与预订,支持搜索车次列表并在线下单 | searchLowestPriceTrain(查询车次)queryTrainDetail(车次详情)bookTrain(预订下单)queryTrainOrderDetail(订单详情)cancelOrder(取消订单) | 火车票服务 |
cruise | 邮轮产品搜索与预订,支持按日期/航线/品牌筛选,兼容"游轮"说法 | searchCruiseList(邮轮搜索)getCruiseProductDetail(产品详情)getCruiseBookingRequiredInfo(预订信息)saveCruiseOrder(创建订单) | 邮轮服务 |
holiday | 度假产品搜索与预订,支持目的地/出游日期/品类筛选,兼容跟团、自助游、自驾游、当地游等表述 | searchHolidayList(度假列表搜索)getHolidayProductDetail(产品详情与团期日历)getHolidayBookingRequiredInfo(预订说明)saveHolidayOrder(创建订单) | 度假服务 |
详细工具参数请参考各服务文档或使用
tuniu help <server> <tool>查看。
