tyc-cli 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ### 架构重构
8
8
 
9
9
  - **CLI 改为 MCP 客户端**:不再直连 tyc OpenAPI,所有工具调用走天眼查 MCP Server
10
- `https://ai-mcp.tianyancha.com/mcp`(默认),`--url` 可覆盖到自建 MCP
10
+ `https://mcp.tianyancha.com/v1`(默认),`--url` 可覆盖到自建 MCP
11
11
  - **移除本地业务逻辑**:多源聚合 / 时间戳格式化 / `_summary` 注入 / 空结果归一化
12
12
  全部下沉到 MCP Server 端;CLI 只负责命令树、参数透传、`--md/--pretty` 呈现
13
13
  - **Session 管理**:首次调用执行 `initialize` 拿 `Mcp-Session-Id`,缓存在
@@ -20,7 +20,7 @@
20
20
 
21
21
  ### 新增
22
22
 
23
- - `tyc init --url <url>`:配置 MCP endpoint(默认 `https://ai-mcp.tianyancha.com/mcp`)
23
+ - `tyc init --url <url>`:配置 MCP endpoint(默认 `https://mcp.tianyancha.com/v1`)
24
24
  - `tyc init --header K=V`(可重复):注入自定义 HTTP header
25
25
  - `tyc init --clear-session`:显式清理本地 session 缓存
26
26
  - `TYC_MCP_ENDPOINT` / `TYC_AUTHORIZATION` 环境变量覆盖
package/README.md CHANGED
@@ -19,7 +19,7 @@ Streamable HTTP)调用天眼查 163 个业务语义聚合工具,覆盖企业
19
19
 
20
20
  - 🧠 **MCP 客户端架构**:CLI 只做协议转换与参数透传;多源合并、时间戳格式化、
21
21
  空结果归一化、`_summary` 注入等业务逻辑由 MCP Server 完成
22
- - 🔌 **即插即用**:默认连接官方 MCP 端点 `https://ai-mcp.tianyancha.com/mcp`;
22
+ - 🔌 **即插即用**:默认连接官方 MCP 端点 `https://mcp.tianyancha.com/v1`;
23
23
  支持 `--url` 指向私有部署
24
24
  - 🔄 **Session 复用**:`Mcp-Session-Id` 本地缓存 24 小时,后续调用零 initialize 开销
25
25
  - 🎯 **6 大业务分类 / 163 个工具**:企业基础信息 · 风险合规 · 知识产权 · 经营与公示 · 历史信息 · 董监高
@@ -53,7 +53,7 @@ npm install && npm run build && npm link
53
53
  tyc init --authorization "YOUR_API_TOKEN"
54
54
 
55
55
  # 连接自建 MCP
56
- tyc init --authorization "YOUR_API_TOKEN" --url "http://your-mcp-host:8080/mcp"
56
+ tyc init --authorization "YOUR_API_TOKEN" --url "http://your-mcp-host:8080/v1"
57
57
 
58
58
  # 仅写配置、不校验(离线环境或先配好稍后上线)
59
59
  tyc init --authorization "YOUR_API_TOKEN" --no-verify
@@ -66,7 +66,7 @@ tyc init --authorization "YOUR_API_TOKEN" --no-verify
66
66
 
67
67
  ```json
68
68
  {
69
- "url": "https://ai-mcp.tianyancha.com/mcp",
69
+ "url": "https://mcp.tianyancha.com/v1",
70
70
  "headers": {
71
71
  "Authorization": "YOUR_API_TOKEN"
72
72
  }
@@ -196,7 +196,7 @@ tyc executive person-risk-overview "..." --humanName "张三"
196
196
  ```
197
197
  ┌─────────────┐ ┌─────────────────────────────┐ ┌─────────────────┐
198
198
  │ tyc-cli │ ──JSON──▶│ 天眼查 MCP Server │ ──HTTP──▶│ tyc OpenAPI │
199
- │ (npm / TS) │ ◀───RPC──│ (ai-mcp.tianyancha.com/mcp) │ ◀───────│ │
199
+ │ (npm / TS) │ ◀───RPC──│ (mcp.tianyancha.com/v1) │ ◀───────│ │
200
200
  └─────────────┘ └─────────────────────────────┘ └─────────────────┘
201
201
  │ │
202
202
  │ └─ 多源并发聚合 · 时间戳格式化 · _summary 注入 · 空结果归一化
@@ -262,7 +262,7 @@ tyc-cli/
262
262
 
263
263
  ```json
264
264
  {
265
- "url": "https://ai-mcp.tianyancha.com/mcp",
265
+ "url": "https://mcp.tianyancha.com/v1",
266
266
  "sessionId": "mcp-session-xxx",
267
267
  "initializedAt": 1777272039739,
268
268
  "protocolVersion": "2024-11-05"
@@ -296,7 +296,7 @@ tyc-cli/
296
296
  | 协议 | MCP client(JSON-RPC over Streamable HTTP) | MCP server |
297
297
  | 实现 | TypeScript | Go |
298
298
  | 职责 | 命令树 · 参数透传 · 格式化输出 | 多源聚合 · 时间戳格式化 · 元数据注入 · Authorization 透传至 OpenAPI |
299
- | 运维 | 用户本地安装 | 官方托管 `ai-mcp.tianyancha.com`,或用户自建 |
299
+ | 运维 | 用户本地安装 | 官方托管 `mcp.tianyancha.com`,或用户自建 |
300
300
 
301
301
  CLI 和 MCP Server 共享同一 163 工具清单;工具元数据从打包内的 `catalog.json`
302
302
  读取,保证命令树冷启动零网络开销。
@@ -321,7 +321,7 @@ bash test/t1_1/cli/run_t1_1.sh -o -v
321
321
  MCP_URL=https://my-mcp.example.com/mcp AUTH_TOKEN=xxx bash test/t1_1/cli/run_t1_1.sh
322
322
  ```
323
323
 
324
- `-o` = `--online`,切到 `https://ai-mcp.tianyancha.com/mcp`;`-v` = `--verbose`。
324
+ `-o` = `--online`,切到 `https://mcp.tianyancha.com/v1`;`-v` = `--verbose`。
325
325
  单分类脚本加 `-p` 可独立触发 preflight:`bash test/t1_1/cli/test_company.sh -p -o`。
326
326
 
327
327
  ---
package/dist/catalog.json CHANGED
@@ -675,7 +675,8 @@
675
675
  "required": true,
676
676
  "description": "企业名称 或 统一社会信用代码"
677
677
  }
678
- ]
678
+ ],
679
+ "priority": true
679
680
  },
680
681
  {
681
682
  "name": "get_stock_executives",
@@ -964,7 +965,8 @@
964
965
  "required": true,
965
966
  "description": "人员姓名"
966
967
  }
967
- ]
968
+ ],
969
+ "priority": true
968
970
  },
969
971
  {
970
972
  "name": "get_personnel_controlled_companies",
@@ -1446,7 +1448,8 @@
1446
1448
  "required": true,
1447
1449
  "description": "企业名称 或 统一社会信用代码"
1448
1450
  }
1449
- ]
1451
+ ],
1452
+ "priority": true
1450
1453
  },
1451
1454
  {
1452
1455
  "name": "get_historical_shareholders",
@@ -1675,7 +1678,8 @@
1675
1678
  "required": true,
1676
1679
  "description": "企业名称 或 统一社会信用代码"
1677
1680
  }
1678
- ]
1681
+ ],
1682
+ "priority": true
1679
1683
  },
1680
1684
  {
1681
1685
  "name": "search_patents",
@@ -1759,7 +1763,8 @@
1759
1763
  "required": true,
1760
1764
  "description": "企业名称 或 统一社会信用代码"
1761
1765
  }
1762
- ]
1766
+ ],
1767
+ "priority": true
1763
1768
  },
1764
1769
  {
1765
1770
  "name": "get_bonds",
@@ -2558,7 +2563,8 @@
2558
2563
  "required": true,
2559
2564
  "description": "企业名称 或 统一社会信用代码"
2560
2565
  }
2561
- ]
2566
+ ],
2567
+ "priority": true
2562
2568
  },
2563
2569
  {
2564
2570
  "name": "get_judicial_documents",
@@ -1,4 +1,4 @@
1
- import { getCategories, getCategoryName, getLayerCount, getToolsByLayer, getTotalCount, } from "../registry.js";
1
+ import { getCategories, getCategoryName, getLayerCount, getPriorityTools, getToolsByLayer, getTotalCount, } from "../registry.js";
2
2
  const LAYER_SPECS = [
3
3
  {
4
4
  layer: "L0",
@@ -54,11 +54,17 @@ function registerLayers(program) {
54
54
  contract: s.contract,
55
55
  })),
56
56
  categories: getCategories(),
57
+ l2_priority: getPriorityTools().map((t) => ({
58
+ facet: t.group,
59
+ tool: t.name,
60
+ cli: `tyc ${t.group} ${t.cliMethod}`,
61
+ description: t.description,
62
+ })),
57
63
  recommended_call_order: [
58
64
  `0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (search_companies); lock onto a USCC + official name`,
59
65
  `1. Ascend to L1 — pick ONE of the ${getLayerCount("L1")} overview tools with the anchored USCC`,
60
66
  "2. Read _summary + drill_down hints from the response",
61
- `3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools)`,
67
+ `3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools); when unsure which L2, default to the facet's L2 优先 (★, see l2_priority)`,
62
68
  `4. Reach L3 for id-based detail, search_*, or vertical SKILL tools (${getLayerCount("L3")} tools)`,
63
69
  ],
64
70
  };
@@ -91,6 +97,9 @@ function registerLayerCmd(program, spec) {
91
97
  count: tools.length,
92
98
  trigger: spec.trigger,
93
99
  contract: spec.contract,
100
+ priority_count: layer === "L2"
101
+ ? tools.filter((t) => t.priority).length
102
+ : undefined,
94
103
  tools: tools.map((t) => ({
95
104
  name: t.name,
96
105
  group: t.group,
@@ -98,6 +107,7 @@ function registerLayerCmd(program, spec) {
98
107
  cli: `tyc ${t.group} ${t.cliMethod}`,
99
108
  description: t.description,
100
109
  params: t.params ?? [],
110
+ ...(t.priority ? { priority: true } : {}),
101
111
  })),
102
112
  };
103
113
  console.log(JSON.stringify(payload, null, 2));
@@ -129,13 +139,22 @@ function renderLayersText() {
129
139
  lines.push(` Trigger: ${s.trigger}`);
130
140
  lines.push(` Contract: ${s.contract}`);
131
141
  lines.push(` List: tyc ${s.layer} list [--md|--json]`);
142
+ if (s.layer === "L2") {
143
+ const prio = getPriorityTools();
144
+ lines.push("");
145
+ lines.push(` L2 优先(★ "L2★ 队副",每 facet 1 个,共 ${prio.length} 个):Agent 拿到 L1 _summary`);
146
+ lines.push(" 若不确定走哪个 L2,默认推这 6 个之一:");
147
+ for (const t of prio) {
148
+ lines.push(` ★ ${pad(t.group, 22)} ${pad(t.name, 36)} (tyc ${t.group} ${t.cliMethod})`);
149
+ }
150
+ }
132
151
  lines.push("");
133
152
  }
134
153
  lines.push("Recommended call order for agents:");
135
154
  lines.push(` 0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (search_companies)`);
136
155
  lines.push(` 1. Ascend to L1 — one of the ${getLayerCount("L1")} overview tools, with the anchored USCC`);
137
156
  lines.push(" 2. Read _summary + drill_down hints in the response");
138
- lines.push(` 3. Drill to L2 for a specific dimension (${getLayerCount("L2")} tools)`);
157
+ lines.push(` 3. Drill to L2 for a specific dimension (${getLayerCount("L2")} tools); unsure which L2 → default to that facet's L2★ 优先 (see L2 block above)`);
139
158
  lines.push(` 4. Reach L3 for id-based detail / search_* / vertical SKILL (${getLayerCount("L3")} tools)`);
140
159
  return lines.join("\n");
141
160
  }
@@ -153,12 +172,24 @@ function renderLayersMarkdown() {
153
172
  lines.push(`| **${s.layer}** ${s.title} | ${getLayerCount(s.layer)} | ${escapeCell(s.summary)} | ${escapeCell(s.trigger)} |`);
154
173
  }
155
174
  lines.push("");
175
+ // L2 优先("L2★ 队副")映射表
176
+ const prio = getPriorityTools();
177
+ lines.push(`**L2 优先 ★ — \`L2★ 队副\`(${prio.length} 个,每 facet 1 个)**`);
178
+ lines.push("");
179
+ lines.push("> Agent 拿到 L1 `_summary` 后若不确定走哪个 L2,默认推对应 facet 的 L2 优先工具。");
180
+ lines.push("");
181
+ lines.push("| facet | L2★ 优先工具 | CLI |");
182
+ lines.push("|---|---|---|");
183
+ for (const t of prio) {
184
+ lines.push(`| ${t.group} | \`${t.name}\` | \`tyc ${t.group} ${t.cliMethod}\` |`);
185
+ }
186
+ lines.push("");
156
187
  lines.push("**Recommended call order for agents**");
157
188
  lines.push("");
158
189
  lines.push(`0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (\`search_companies\`); lock onto a USCC + official name.`);
159
190
  lines.push(`1. Ascend to L1 — pick ONE of the ${getLayerCount("L1")} overview tools with the anchored USCC.`);
160
191
  lines.push("2. Read `_summary` + `drill_down` hints in the response.");
161
- lines.push(`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools).`);
192
+ lines.push(`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools). Unsure which L2 → default to that facet's L2★ 优先 (table above).`);
162
193
  lines.push(`4. Reach L3 for id-based detail, \`search_*\`, or vertical SKILL tools (${getLayerCount("L3")} tools).`);
163
194
  lines.push("");
164
195
  lines.push("**Discover each layer**");
@@ -175,6 +206,24 @@ function renderLayerListText(spec, tools) {
175
206
  lines.push(`${spec.layer} · ${spec.title} (${n} tool${n === 1 ? "" : "s"})`);
176
207
  lines.push(`Trigger: ${spec.trigger}`);
177
208
  lines.push("");
209
+ // L2 优先置顶(只在 L2 list 渲染)
210
+ if (spec.layer === "L2") {
211
+ const prio = tools.filter((t) => t.priority);
212
+ if (prio.length > 0) {
213
+ lines.push(`★ L2 优先("L2★ 队副",${prio.length} 个,每 facet 1 个)`);
214
+ lines.push(" Agent 拿到 L1 _summary 不确定走哪个 L2 时,默认推这 6 个之一。");
215
+ const groupsOrder = getCategories().map((c) => c.group);
216
+ const orderIdx = new Map();
217
+ groupsOrder.forEach((g, i) => orderIdx.set(g, i));
218
+ const sortedPrio = [...prio].sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
219
+ for (const t of sortedPrio) {
220
+ const cli = `tyc ${t.group} ${t.cliMethod}`;
221
+ lines.push(` ★ ${pad(t.group, 22)} ${pad(t.name, 36)} ${cli}`);
222
+ lines.push(` ${oneLine(t.description)}`);
223
+ }
224
+ lines.push("");
225
+ }
226
+ }
178
227
  // 按 group 分组打印(按 categories 中声明顺序)
179
228
  const groupsOrder = getCategories().map((c) => c.group);
180
229
  const grouped = new Map();
@@ -191,7 +240,8 @@ function renderLayerListText(spec, tools) {
191
240
  lines.push(`── ${g} (${zh}, ${arr.length}) ──`);
192
241
  for (const t of arr) {
193
242
  const cli = `tyc ${t.group} ${t.cliMethod}`;
194
- lines.push(` ${pad(t.name, 46)} ${cli}`);
243
+ const star = t.priority ? "★ " : " ";
244
+ lines.push(` ${star}${pad(t.name, 46)} ${cli}`);
195
245
  lines.push(` ${oneLine(t.description)}`);
196
246
  }
197
247
  lines.push("");
@@ -207,6 +257,27 @@ function renderLayerListMarkdown(spec, tools) {
207
257
  lines.push(`> **${n} tool${n === 1 ? "" : "s"}** · ${spec.summary} `);
208
258
  lines.push(`> Trigger: ${spec.trigger}`);
209
259
  lines.push("");
260
+ // L2 优先置顶(只在 L2 list 渲染)
261
+ if (spec.layer === "L2") {
262
+ const prio = tools.filter((t) => t.priority);
263
+ if (prio.length > 0) {
264
+ const groupsOrder = getCategories().map((c) => c.group);
265
+ const orderIdx = new Map();
266
+ groupsOrder.forEach((g, i) => orderIdx.set(g, i));
267
+ const sortedPrio = [...prio].sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
268
+ lines.push(`## ★ L2 优先(\`L2★ 队副\`,${prio.length} 个)`);
269
+ lines.push("");
270
+ lines.push("> 每 facet 1 个;Agent 拿到 L1 `_summary` 不确定走哪个 L2 时,默认推这 6 个之一。");
271
+ lines.push("");
272
+ lines.push("| ★ | facet | Tool | CLI | Description |");
273
+ lines.push("|---|---|---|---|---|");
274
+ for (const t of sortedPrio) {
275
+ const cli = `\`tyc ${t.group} ${t.cliMethod}\``;
276
+ lines.push(`| ★ | ${t.group} | \`${t.name}\` | ${cli} | ${escapeCell(oneLine(t.description))} |`);
277
+ }
278
+ lines.push("");
279
+ }
280
+ }
210
281
  const groupsOrder = getCategories().map((c) => c.group);
211
282
  const grouped = new Map();
212
283
  for (const t of tools) {
@@ -225,7 +296,8 @@ function renderLayerListMarkdown(spec, tools) {
225
296
  lines.push("|---|---|---|");
226
297
  for (const t of arr) {
227
298
  const cli = `\`tyc ${t.group} ${t.cliMethod}\``;
228
- lines.push(`| \`${t.name}\` | ${cli} | ${escapeCell(oneLine(t.description))} |`);
299
+ const name = t.priority ? `★ \`${t.name}\`` : `\`${t.name}\``;
300
+ lines.push(`| ${name} | ${cli} | ${escapeCell(oneLine(t.description))} |`);
229
301
  }
230
302
  lines.push("");
231
303
  }
package/dist/config.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // ~/.tyc/config.json 读写
2
2
  //
3
3
  // 配置文件格式与通用 MCP 客户端保持一致:
4
- // { "url": "https://ai-mcp.tianyancha.com/mcp",
4
+ // { "url": "https://mcp.tianyancha.com/v1",
5
5
  // "headers": { "Authorization": "xxxx" } }
6
6
  //
7
7
  // 默认端点指向 tyc 官方生产 MCP;本地调试通过
8
- // tyc init --url http://localhost:8080/mcp 或 TYC_MCP_ENDPOINT 环境变量覆盖。
8
+ // tyc init --url http://localhost:8080/v1 或 TYC_MCP_ENDPOINT 环境变量覆盖。
9
9
  import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from "node:fs";
10
10
  import { join } from "node:path";
11
11
  import { homedir } from "node:os";
12
12
  const CONFIG_DIR = join(homedir(), ".tyc");
13
13
  const CONFIG_FILE = join(CONFIG_DIR, "config.json");
14
- export const DEFAULT_MCP_URL = "https://ai-mcp.tianyancha.com/mcp";
14
+ export const DEFAULT_MCP_URL = "https://mcp.tianyancha.com/v1";
15
15
  export function loadConfig() {
16
16
  if (!existsSync(CONFIG_FILE))
17
17
  return null;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Command } from "commander";
3
3
  import { registerInitCommand } from "./commands/init.js";
4
4
  import { registerCategoryCommands } from "./commands/category.js";
5
5
  import { registerLayerCommands } from "./commands/layers.js";
6
- import { getCategories, getLayerCount, getTotalCount, } from "./registry.js";
6
+ import { getCategories, getLayerCount, getPriorityTools, getTotalCount, } from "./registry.js";
7
7
  // 顶层 help:把"最懂 AI 的 CLI"落在 4 层架构 + 调用顺序 + 可发现性上。
8
8
  // Agent 看 tyc --help 时应立刻读懂"先 L0 锚定企业,再 L1 概览,再 L2 下钻,最后 L3 详情"这条主线。
9
9
  const helpText = `
@@ -16,7 +16,7 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
16
16
 
17
17
  ┌─ L0 Resolve ${pad(getLayerCount("L0"), 3)} tool entity resolution · 简称/曾用名/模糊名 → 精确企业
18
18
  ├─ L1 Overview ${pad(getLayerCount("L1"), 3)} tools one captain per facet · returns _summary + drill_down
19
- ├─ L2 Drill-down ${pad(getLayerCount("L2"), 3)} tools one-hop into a specific data dimension
19
+ ├─ L2 Drill-down ${pad(getLayerCount("L2"), 3)} tools one-hop into a specific data dimension (★ = L2 优先, see below)
20
20
  └─ L3 Specialized ${pad(getLayerCount("L3"), 3)} tools id-based detail · search_* · vertical SKILLs
21
21
 
22
22
  Recommended call order:
@@ -28,6 +28,7 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
28
28
  anchored USCC. Read the response's _summary + drill_down.
29
29
  2. Descend to L2. Follow hints to a specific dimension
30
30
  (shareholders / litigation / patents / annual reports …).
31
+ If unsure which L2, default to that facet's L2★ 优先 (below).
31
32
  3. Land on L3. When L2 returns a list item with an \`id\`, a \`search_*\`
32
33
  need arises, or a vertical SKILL is activated.
33
34
 
@@ -36,15 +37,23 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
36
37
  in hand) wastes downstream calls on the wrong entity.
37
38
  Default LLM surface = L0 + L1 = ${getLayerCount("L0") + getLayerCount("L1")} tools (≤ 15-tool exposure limit).
38
39
 
40
+ L2 优先 ★ — \`L2★ 队副\`(${getPriorityTools().length} 个,每 facet 1 个)
41
+
42
+ Agent 拿到 L1 _summary 后若不确定走哪个 L2,对应 facet 的"L2 优先"是默认下钻:
43
+
44
+ ${renderPriorityLines()}
45
+
46
+ Detail: tyc layers / tyc L2 list (★ marks priority rows)
47
+
39
48
  DISCOVER BY LAYER
40
49
 
41
- tyc layers one-screen architecture map
50
+ tyc layers one-screen architecture map (含 L2 优先映射)
42
51
  tyc L0 list list the ${getLayerCount("L0")} L0 tool (entity-resolve layer)
43
52
  tyc L1 list list all ${getLayerCount("L1")} L1 tools (overview, grouped)
44
- tyc L2 list list all ${getLayerCount("L2")} L2 tools (drill-down, grouped)
53
+ tyc L2 list list all ${getLayerCount("L2")} L2 tools (drill-down; ★ priority pinned to top)
45
54
  tyc L3 list list all ${getLayerCount("L3")} L3 tools (specialized, grouped)
46
55
  tyc L0 list --md Markdown tables (agent on-screen)
47
- tyc L0 list --json machine-readable JSON (id · cli · params · description)
56
+ tyc L0 list --json machine-readable JSON (id · cli · params · description · priority)
48
57
 
49
58
  DISCOVER BY CATEGORY (orthogonal to layers, 6 groups)
50
59
 
@@ -59,7 +68,7 @@ OUTPUT FORMATS (mutually exclusive, priority: --md > --pretty > default)
59
68
 
60
69
  SETUP
61
70
 
62
- tyc init --authorization <KEY> default https://ai-mcp.tianyancha.com/mcp
71
+ tyc init --authorization <KEY> default https://mcp.tianyancha.com/v1
63
72
  tyc init --url <MCP_URL> --authorization <KEY> local / self-hosted
64
73
 
65
74
  Every tool returns tyc OpenAPI native English keys verbatim. The MCP Server
@@ -78,6 +87,13 @@ function renderCategoryLines() {
78
87
  }
79
88
  return lines.join("\n");
80
89
  }
90
+ function renderPriorityLines() {
91
+ const lines = [];
92
+ for (const t of getPriorityTools()) {
93
+ lines.push(` ★ ${t.group.padEnd(22)} ${t.name.padEnd(36)} (tyc ${t.group} ${t.cliMethod})`);
94
+ }
95
+ return lines.join("\n");
96
+ }
81
97
  const program = new Command()
82
98
  .name("tyc")
83
99
  .description(`Tianyan AI CLI — ${getTotalCount()} commercial-data tools · L0=${getLayerCount("L0")} L1=${getLayerCount("L1")} L2=${getLayerCount("L2")} L3=${getLayerCount("L3")} · the AI-native gateway (pair with the TA MCP Server)`)
package/dist/registry.js CHANGED
@@ -62,3 +62,13 @@ export function getLayerCount(layer) {
62
62
  export function getCategoryName(group) {
63
63
  return getCategories().find((c) => c.group === group)?.name_zh ?? group;
64
64
  }
65
+ // 6 个 L2 优先工具("L2★ 队副"):每 facet 1 个,Agent 在 L1 _summary 之后
66
+ // 若不确定该往哪个 L2 钻,默认推这 6 个之一。order 与 categories 声明顺序一致。
67
+ export function getPriorityTools() {
68
+ const groupsOrder = getCategories().map((c) => c.group);
69
+ const orderIdx = new Map();
70
+ groupsOrder.forEach((g, i) => orderIdx.set(g, i));
71
+ return load()
72
+ .tools.filter((t) => t.priority === true)
73
+ .sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tyc-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "天眼查 MCP CLI — 163 个业务语义聚合工具 · 命令行直达企业数据 · 通过 MCP Server 调用",
5
5
  "main": "dist/index.js",
6
6
  "bin": {