tyc-cli 0.3.10 → 0.3.11

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/README.md CHANGED
@@ -12,11 +12,11 @@
12
12
  ## 📖 项目简介
13
13
 
14
14
  `tyc-cli` 是天眼查 MCP Server 的官方命令行客户端。CLI 通过 shared core HTTP 入口
15
- 调用天眼查 162 个业务语义聚合工具,覆盖企业工商、知产、司法风险、董监高等全维度
15
+ 调用天眼查 165 个业务语义聚合工具,覆盖企业工商、知产、司法风险、董监高等全维度
16
16
  商业数据。
17
17
 
18
18
  当前 MCP Server 的 `tools/list` 默认只公开少量 AI Agent 入口工具
19
- (搜索、公司画像、能力目录、`call_tool` / `call_tools_batch` 等),但 162 个业务语义
19
+ (搜索、公司画像、能力目录、`call_tool` / `call_tools_batch` 等),但 165 个业务语义
20
20
  工具仍注册在服务端并保持 `tools/call` 兼容。CLI 不依赖 `tools/list` 构建命令树,
21
21
  而是使用打包内 `catalog.json` 直达这些业务工具。
22
22
 
@@ -27,7 +27,7 @@
27
27
  - 🔌 **公网优先**:默认连接天眼查 MCP 端点 `https://mcp.tianyancha.com/mcp`;
28
28
  支持 `--url` 指向本地或私有部署
29
29
  - 🔄 **无本地 MCP Session**:CLI 调用 stateless shared core endpoint,不缓存 `Mcp-Session-Id`
30
- - 🎯 **6 大业务分类 / 162 个工具**:企业基础信息 · 风险合规 · 知识产权 · 经营与公示 · 历史信息 · 董监高
30
+ - 🎯 **6 大业务分类 / 165 个工具**:企业基础信息 · 风险合规 · 知识产权 · 经营与公示 · 历史信息 · 董监高
31
31
  - 🤖 **AI Agent 友好**:tyc 英文 key 透传 / 时间戳格式化 / `_summary / _empty / _warnings` 元数据
32
32
 
33
33
  ---
@@ -374,7 +374,7 @@ HTTP 402 同样返回退出码 1 并保留服务端错误说明,不自动重
374
374
  | 职责 | 命令树 · 参数透传 · 格式化输出 | 多源聚合 · 时间戳格式化 · 元数据注入 · Authorization 透传至 OpenAPI |
375
375
  | 运维 | 用户本地安装 | 默认连接官方托管 `mcp.tianyancha.com`,也可切到本机 apimcp 或用户自建 |
376
376
 
377
- CLI 和 MCP Server 共享同一 162 工具清单;工具元数据从打包内的 `catalog.json`
377
+ CLI 和 MCP Server 共享同一 165 工具清单;工具元数据从打包内的 `catalog.json`
378
378
  读取,保证命令树冷启动零网络开销。
379
379
 
380
380
  ---
@@ -414,3 +414,9 @@ MCP_URL=https://my-mcp.example.com/mcp AUTH_TOKEN=xxx bash test/t1_1/cli/run_t1_
414
414
  本项目采用 [MIT License](LICENSE)。
415
415
 
416
416
  数据来源:天眼查 OpenAPI(用户需自行获取并合规使用 token)。本工具不存储、不转发、不解析用户的查询数据,所有调用经天眼查 MCP Server 转发。
417
+
418
+ ### 限制出境(L2)
419
+
420
+ `tyc risk exit-restriction "广东振戎能源有限公司" --pageNum 1 --pageSize 20 --md`
421
+
422
+ 每页默认及最大 20 条。关键词匹配申请执行人和被执行人,命中不代表企业或其高管被限制出境。走 MCP 计费的用户每次有效查询扣 1 次,无结果或失败扣 0 次,翻页独立计次;企业独立凭据通道不进入 MCP 本地计费。完整字段及披露规则见[风险合规](../../docs/t1_1/apis/风险合规.md)。
package/dist/catalog.json CHANGED
@@ -10,7 +10,7 @@
10
10
  {
11
11
  "group": "risk",
12
12
  "name_zh": "风险合规",
13
- "tool_count": 35
13
+ "tool_count": 38
14
14
  },
15
15
  {
16
16
  "group": "intellectual_property",
@@ -25,7 +25,7 @@
25
25
  {
26
26
  "group": "history",
27
27
  "name_zh": "历史信息",
28
- "tool_count": 17
28
+ "tool_count": 18
29
29
  },
30
30
  {
31
31
  "group": "executive",
@@ -44,11 +44,11 @@
44
44
  },
45
45
  {
46
46
  "layer": "L2",
47
- "count": 57
47
+ "count": 58
48
48
  },
49
49
  {
50
50
  "layer": "L3",
51
- "count": 98
51
+ "count": 101
52
52
  }
53
53
  ],
54
54
  "tools": [
@@ -907,7 +907,7 @@
907
907
  "requiredPlan": "vip",
908
908
  "cliMethod": "stock-shareholders",
909
909
  "categoryNameZh": "企业基础信息",
910
- "description": "查询上市公司股东信息,包含十大股东(十大流通股东)和参股控股。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
910
+ "description": "查询上市公司股东榜单及参股控股信息。type=1查询十大股东(默认),type=2查询十大流通股东;一次仅查询一种股东榜单。time可指定股东榜单期次,格式YYYY-MM-DD,建议从返回的timeList选择;不传时采用下游默认期次,实际日期以返回记录为准。type和time仅影响股东榜单来源,pageNum/pageSize仅影响参股控股来源。需要比较两种榜单时,应使用相同time分别调用。股份类型shareType不能用于判断榜单类型。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
911
911
  "params": [
912
912
  {
913
913
  "name": "searchKey",
@@ -915,15 +915,30 @@
915
915
  "required": true,
916
916
  "description": "企业名称、统一社会信用代码或天眼查企业 ID"
917
917
  },
918
+ {
919
+ "default": "1",
920
+ "enum": [
921
+ "1",
922
+ "2"
923
+ ],
924
+ "name": "type",
925
+ "type": "string",
926
+ "description": "股东榜单类型:1=十大股东(默认),2=十大流通股东;仅作用于股东榜单来源"
927
+ },
928
+ {
929
+ "name": "time",
930
+ "type": "string",
931
+ "description": "股东榜单查询期次,格式YYYY-MM-DD;建议从timeList选择。不传采用下游默认期次;不影响参股控股来源"
932
+ },
918
933
  {
919
934
  "name": "pageNum",
920
935
  "type": "number",
921
- "description": "页码(可选,默认 1)"
936
+ "description": "参股控股页码(可选,默认 1);不对股东榜单分页"
922
937
  },
923
938
  {
924
939
  "name": "pageSize",
925
940
  "type": "number",
926
- "description": "每页大小(可选,默认 10,常见上限 100)"
941
+ "description": "参股控股每页大小(可选,默认 10);不对股东榜单分页"
927
942
  }
928
943
  ]
929
944
  },
@@ -1772,6 +1787,33 @@
1772
1787
  }
1773
1788
  ]
1774
1789
  },
1790
+ {
1791
+ "name": "get_historical_environmental_penalty",
1792
+ "group": "history",
1793
+ "layer": "L3",
1794
+ "requiredPlan": "vip",
1795
+ "cliMethod": "historical-environmental-penalty",
1796
+ "categoryNameZh": "历史信息",
1797
+ "description": "查询企业历史环保处罚记录,返回决定书文号、处罚日期、 处罚单位和处罚金额(元),用于历史环保合规排查。 违法类型为上游保留字段,可能为空。 支持企业名称或统一社会信用代码,历史记录不表示处罚已撤销或已整改。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
1798
+ "params": [
1799
+ {
1800
+ "name": "searchKey",
1801
+ "type": "string",
1802
+ "required": true,
1803
+ "description": "精确企业名称或统一社会信用代码,不支持直接使用企业 ID"
1804
+ },
1805
+ {
1806
+ "name": "pageNum",
1807
+ "type": "number",
1808
+ "description": "页码,须为正整数,默认 1"
1809
+ },
1810
+ {
1811
+ "name": "pageSize",
1812
+ "type": "number",
1813
+ "description": "每页条数,须为 1–20 的整数,默认 10"
1814
+ }
1815
+ ]
1816
+ },
1775
1817
  {
1776
1818
  "name": "get_historical_equity_freeze",
1777
1819
  "group": "history",
@@ -2614,7 +2656,7 @@
2614
2656
  "requiredPlan": "vip",
2615
2657
  "cliMethod": "company-announcement",
2616
2658
  "categoryNameZh": "经营与公示",
2617
- "description": "查询企业公告信息,包含上市公告和公告研报。适用于核验上市公司公告、破产重整/清算公告、管理人公告、资产处置公告、投资人招募公告。遇到“税务/规划/司法三重关卡”“资金来源”“交易对价”“股权比例”“担保责任”等问题时,应优先用公告原文核验,并按用户给定框架分别检查税务、规划/政策、司法/执行等维度。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2659
+ "description": "查询上市公告及企业研报或相关公告。type=0查询企业研报,type=1查询相关公告(默认),仅作用于公告研报来源。相关公告可能由其他主体发布;返回标题、日期与原文链接,不代表已读取原文。适用于核验上市公司公告、破产重整/清算公告、管理人公告、资产处置公告、投资人招募公告。遇到“税务/规划/司法三重关卡”“资金来源”“交易对价”“股权比例”“担保责任”等问题时,应优先用公告原文核验,并按用户给定框架分别检查税务、规划/政策、司法/执行等维度。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2618
2660
  "params": [
2619
2661
  {
2620
2662
  "name": "searchKey",
@@ -2622,6 +2664,16 @@
2622
2664
  "required": true,
2623
2665
  "description": "企业名称、统一社会信用代码或天眼查企业 ID"
2624
2666
  },
2667
+ {
2668
+ "default": "1",
2669
+ "enum": [
2670
+ "0",
2671
+ "1"
2672
+ ],
2673
+ "name": "type",
2674
+ "type": "number",
2675
+ "description": "公告研报查询类型:0=企业研报,1=相关公告(默认);不影响上市公告来源"
2676
+ },
2625
2677
  {
2626
2678
  "name": "pageNum",
2627
2679
  "type": "number",
@@ -2630,7 +2682,7 @@
2630
2682
  {
2631
2683
  "name": "pageSize",
2632
2684
  "type": "number",
2633
- "description": "每页大小(可选,默认 10,常见上限 100)"
2685
+ "description": "每个来源每页大小(可选,默认 10,最大 20;超出按 20 查询)"
2634
2686
  }
2635
2687
  ]
2636
2688
  },
@@ -2722,7 +2774,7 @@
2722
2774
  "requiredPlan": "vip",
2723
2775
  "cliMethod": "honor-info",
2724
2776
  "categoryNameZh": "经营与公示",
2725
- "description": "查询企业荣誉、获奖情况(从上榜榜单中按荣誉类标签筛选)。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2777
+ "description": "查询企业荣誉、奖项及认定,返回荣誉名称、状态、类型、级别、认证单位、有效期和来源。recordScope 支持 current(有效,默认)、historical(历史)、all(全部);上榜榜单请使用 get_ranking_list_info。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2726
2778
  "params": [
2727
2779
  {
2728
2780
  "name": "searchKey",
@@ -2730,6 +2782,17 @@
2730
2782
  "required": true,
2731
2783
  "description": "企业名称、统一社会信用代码或天眼查企业 ID"
2732
2784
  },
2785
+ {
2786
+ "default": "current",
2787
+ "enum": [
2788
+ "current",
2789
+ "historical",
2790
+ "all"
2791
+ ],
2792
+ "name": "recordScope",
2793
+ "type": "string",
2794
+ "description": "查询范围:current=有效(默认)、historical=历史、all=全部;不是按过去日期查询快照"
2795
+ },
2733
2796
  {
2734
2797
  "name": "pageNum",
2735
2798
  "type": "number",
@@ -2738,7 +2801,7 @@
2738
2801
  {
2739
2802
  "name": "pageSize",
2740
2803
  "type": "number",
2741
- "description": "每页大小(可选,默认 20,常见上限 100)"
2804
+ "description": "每页大小(可选,默认 20,最大 20;超过时按 20 查询并返回请求值与生效值)"
2742
2805
  }
2743
2806
  ]
2744
2807
  },
@@ -2766,13 +2829,13 @@
2766
2829
  "requiredPlan": "vip",
2767
2830
  "cliMethod": "invest-agency-events",
2768
2831
  "categoryNameZh": "经营与公示",
2769
- "description": "查询投资机构最新投资动态。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2832
+ "description": "查询投资机构最新投资动态。请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2770
2833
  "params": [
2771
2834
  {
2772
2835
  "name": "searchKey",
2773
2836
  "type": "string",
2774
2837
  "required": true,
2775
- "description": "投资机构名称"
2838
+ "description": "请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。"
2776
2839
  },
2777
2840
  {
2778
2841
  "name": "pageNum",
@@ -2793,13 +2856,13 @@
2793
2856
  "requiredPlan": "vip",
2794
2857
  "cliMethod": "invest-agency-funds",
2795
2858
  "categoryNameZh": "经营与公示",
2796
- "description": "查询投资机构基金信息,包含基金管理公司、对外投资基金和基金管理人。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2859
+ "description": "查询投资机构基金信息,包含基金管理公司、对外投资基金和基金管理人。请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2797
2860
  "params": [
2798
2861
  {
2799
2862
  "name": "searchKey",
2800
2863
  "type": "string",
2801
2864
  "required": true,
2802
- "description": "投资机构名称"
2865
+ "description": "请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。"
2803
2866
  },
2804
2867
  {
2805
2868
  "name": "pageNum",
@@ -2820,13 +2883,13 @@
2820
2883
  "requiredPlan": "vip",
2821
2884
  "cliMethod": "invest-agency-news",
2822
2885
  "categoryNameZh": "经营与公示",
2823
- "description": "查询投资机构相关新闻舆情信息。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2886
+ "description": "查询投资机构相关新闻舆情信息。请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2824
2887
  "params": [
2825
2888
  {
2826
2889
  "name": "searchKey",
2827
2890
  "type": "string",
2828
2891
  "required": true,
2829
- "description": "投资机构名称"
2892
+ "description": "请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。"
2830
2893
  },
2831
2894
  {
2832
2895
  "name": "pageNum",
@@ -2847,13 +2910,13 @@
2847
2910
  "requiredPlan": "vip",
2848
2911
  "cliMethod": "invest-agency-profile",
2849
2912
  "categoryNameZh": "经营与公示",
2850
- "description": "查询投资机构画像,包含工商追踪、机构成员和统计分析。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2913
+ "description": "查询投资机构画像,包含工商追踪、机构成员和统计分析。请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2851
2914
  "params": [
2852
2915
  {
2853
2916
  "name": "searchKey",
2854
2917
  "type": "string",
2855
2918
  "required": true,
2856
- "description": "投资机构名称"
2919
+ "description": "请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。"
2857
2920
  },
2858
2921
  {
2859
2922
  "name": "pageNum",
@@ -2874,13 +2937,13 @@
2874
2937
  "requiredPlan": "vip",
2875
2938
  "cliMethod": "invest-agency-public-investments",
2876
2939
  "categoryNameZh": "经营与公示",
2877
- "description": "查询投资机构投资信息,包含公开投资事件和未公开投资。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2940
+ "description": "查询投资机构投资信息,包含公开投资事件和未公开投资。请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
2878
2941
  "params": [
2879
2942
  {
2880
2943
  "name": "searchKey",
2881
2944
  "type": "string",
2882
2945
  "required": true,
2883
- "description": "投资机构名称"
2946
+ "description": "请传投资机构库收录的机构名称,例如“深创投”。使用工商全称可能返回空结果。"
2884
2947
  },
2885
2948
  {
2886
2949
  "name": "pageNum",
@@ -3709,6 +3772,33 @@
3709
3772
  }
3710
3773
  ]
3711
3774
  },
3775
+ {
3776
+ "name": "get_exit_restriction",
3777
+ "group": "risk",
3778
+ "layer": "L2",
3779
+ "requiredPlan": "vip",
3780
+ "cliMethod": "exit-restriction",
3781
+ "categoryNameZh": "风险合规",
3782
+ "description": "查询与企业相关的限制出境记录,包括案号、限制出境对象、被执行人、申请执行人、执行法院、执行标的及发布日期。关键词同时匹配申请执行人和被执行人,命中记录不代表该企业或其高管被限制出境,应结合记录中的角色字段判断。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
3783
+ "params": [
3784
+ {
3785
+ "name": "searchKey",
3786
+ "type": "string",
3787
+ "required": true,
3788
+ "description": "企业名称、统一社会信用代码、天眼查企业 ID 或注册号;同时匹配申请执行人和被执行人"
3789
+ },
3790
+ {
3791
+ "name": "pageNum",
3792
+ "type": "number",
3793
+ "description": "页码,须为正整数,默认 1"
3794
+ },
3795
+ {
3796
+ "name": "pageSize",
3797
+ "type": "number",
3798
+ "description": "每页条数,须为 1–20 的整数,默认 20;超过 20 拒绝调用"
3799
+ }
3800
+ ]
3801
+ },
3712
3802
  {
3713
3803
  "name": "get_guarantee_info",
3714
3804
  "group": "risk",
@@ -3931,6 +4021,43 @@
3931
4021
  }
3932
4022
  ]
3933
4023
  },
4024
+ {
4025
+ "name": "get_labor_arbitration",
4026
+ "group": "risk",
4027
+ "layer": "L3",
4028
+ "requiredPlan": "vip",
4029
+ "cliMethod": "labor-arbitration",
4030
+ "categoryNameZh": "风险合规",
4031
+ "description": "查询企业劳动仲裁公告,必须选择 court 开庭公告或 delivery 送达公告。 返回案号、申请人、被申请人及对应日期;开庭公告另含案由和发布机构。 支持精确企业名称或统一社会信用代码;公告不代表已裁决或败诉。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
4032
+ "params": [
4033
+ {
4034
+ "name": "searchKey",
4035
+ "type": "string",
4036
+ "required": true,
4037
+ "description": "精确企业名称或统一社会信用代码,不支持直接使用企业 ID"
4038
+ },
4039
+ {
4040
+ "enum": [
4041
+ "court",
4042
+ "delivery"
4043
+ ],
4044
+ "name": "noticeType",
4045
+ "type": "string",
4046
+ "required": true,
4047
+ "description": "court 为开庭公告,delivery 为送达公告;每次只查询所选类型"
4048
+ },
4049
+ {
4050
+ "name": "pageNum",
4051
+ "type": "number",
4052
+ "description": "正整数页码,默认 1"
4053
+ },
4054
+ {
4055
+ "name": "pageSize",
4056
+ "type": "number",
4057
+ "description": "每页 1–20 条,默认 10"
4058
+ }
4059
+ ]
4060
+ },
3934
4061
  {
3935
4062
  "name": "get_land_mortgage_info",
3936
4063
  "group": "risk",
@@ -3992,6 +4119,33 @@
3992
4119
  }
3993
4120
  ]
3994
4121
  },
4122
+ {
4123
+ "name": "get_prelitigation_mediation",
4124
+ "group": "risk",
4125
+ "layer": "L3",
4126
+ "requiredPlan": "vip",
4127
+ "cliMethod": "prelitigation-mediation",
4128
+ "categoryNameZh": "风险合规",
4129
+ "description": "查询企业当前诉前调解记录,返回案号、法院、立案日期、案由及当事人分组。 支持精确企业名称或统一社会信用代码;PunishDate 表示立案日期,角色保留上游代码。 不含历史诉前调解,不代表已形成裁判或已达成调解。 数据权益:早鸟期可用;2026年9月1日起需VIP。",
4130
+ "params": [
4131
+ {
4132
+ "name": "searchKey",
4133
+ "type": "string",
4134
+ "required": true,
4135
+ "description": "精确企业名称或统一社会信用代码,不支持直接使用企业 ID"
4136
+ },
4137
+ {
4138
+ "name": "pageNum",
4139
+ "type": "number",
4140
+ "description": "正整数页码,默认 1"
4141
+ },
4142
+ {
4143
+ "name": "pageSize",
4144
+ "type": "number",
4145
+ "description": "每页 1–20 条,默认 10"
4146
+ }
4147
+ ]
4148
+ },
3995
4149
  {
3996
4150
  "name": "get_public_exhortation",
3997
4151
  "group": "risk",
@@ -5,6 +5,8 @@ import { emitToolResult } from "./output.js";
5
5
  const GLOBAL_OUTPUT_HELP = `
6
6
  全局输出选项:所有工具命令均支持 --md / --compact / --pretty / --head / --tail / --full / --threshold / --output-file / --verbose;完整说明见 tyc --help。
7
7
  `;
8
+ // These tools have source- and row-specific ID semantics in the server view.
9
+ const personIdentifierViews = new Set(["get_person_profile", "get_personnel_legal_rep_roles", "get_person_partners", "get_actual_controller"]);
8
10
  export function registerCategoryCommands(program) {
9
11
  for (const cat of getCategories()) {
10
12
  const tools = getToolsByGroup(cat.group);
@@ -58,7 +60,8 @@ function bindMethod(catCmd, tool, program) {
58
60
  const opts = program.opts();
59
61
  const verbose = !!opts.verbose;
60
62
  try {
61
- const result = await callToolWithOAuthRefresh(tool.name, args, verbose);
63
+ const format = opts.md && personIdentifierViews.has(tool.name) ? "markdown" : "json";
64
+ const result = await callCoreToolWithOAuthRefresh(tool.name, args, { verbose, format });
62
65
  emitToolResult(result, opts, tool.name);
63
66
  }
64
67
  catch (err) {
@@ -67,6 +70,3 @@ function bindMethod(catCmd, tool, program) {
67
70
  }
68
71
  });
69
72
  }
70
- async function callToolWithOAuthRefresh(name, args, verbose) {
71
- return callCoreToolWithOAuthRefresh(name, args, { verbose });
72
- }
@@ -1,3 +1,4 @@
1
+ import { renderOA2Items } from "./oa2.js";
1
2
  import { identifierDetails } from "./identifierDetails.js";
2
3
  import { stringifyLosslessJSON, LosslessNumber } from "./losslessJson.js";
3
4
  /**
@@ -11,7 +12,7 @@ import { stringifyLosslessJSON, LosslessNumber } from "./losslessJson.js";
11
12
  */
12
13
  import { renderChangeRecords, splitChangeRecords } from "./personnelChanges.js";
13
14
  import { renderHistoryGuide, splitHistoricalPersonnel } from "./history.js";
14
- const META_KEYS = new Set(["_summary", "_empty", "_warnings", "_tip", "_truncated", "_pagination", "_riskOverview", "_dateSemantics", "_fieldSemantics", "_historyGuide", "_source"]);
15
+ const META_KEYS = new Set(["_summary", "_empty", "_warnings", "_tip", "_truncated", "_pagination", "_riskOverview", "_recordCounts", "_dateSemantics", "_fieldSemantics", "_historyGuide", "_source"]);
15
16
  function isPlainObject(v) {
16
17
  return v !== null && typeof v === "object" && !Array.isArray(v) && !(v instanceof LosslessNumber);
17
18
  }
@@ -148,7 +149,7 @@ function renderMeta(obj) {
148
149
  lines.push(`> 💡 **提示**:${formatPrimitive(obj._tip)}`);
149
150
  }
150
151
  if (obj._empty === true && !isPlainObject(obj._riskOverview)) {
151
- lines.push(`> ⚪ **空结果**:未发现该维度记录`);
152
+ lines.push(`> ⚪ **空结果**:本次未返回记录`);
152
153
  }
153
154
  if (isPlainObject(obj._pagination)) {
154
155
  const p = obj._pagination;
@@ -299,10 +300,78 @@ function renderMarkdownValue(value, toolName) {
299
300
  const meta = renderMeta(obj);
300
301
  if (meta)
301
302
  parts.push(meta);
303
+ const oa2 = renderOA2Items(obj, toolName);
304
+ if (oa2 !== undefined)
305
+ return parts.concat(oa2).join("\n");
302
306
  if (toolName === "get_risk_overview" || isPlainObject(obj._riskOverview)) {
303
307
  parts.push(renderRiskOverview(obj));
304
308
  return parts.join("\n").replace(/\n{3,}/g, "\n\n");
305
309
  }
310
+ if (toolName === "get_stock_shareholders" && isPlainObject(obj.sources)) {
311
+ for (const scope of ["top", "holding"]) {
312
+ const source = obj.sources[scope];
313
+ if (!isPlainObject(source))
314
+ continue;
315
+ const title = scope === "holding" ? "参股控股" : String(source._queryType) === "2" ? "十大流通股东" : String(source._queryType) === "1" ? "十大股东" : "股东榜单";
316
+ parts.push(`## ${title}\n`);
317
+ if (scope === "top" && source._queryType !== undefined)
318
+ parts.push(`> 查询类型:type=${source._queryType};续查保持 --type ${source._queryType}。\n`);
319
+ if (source.status === "error") {
320
+ parts.push(`> 查询失败:${escapeCell(formatPrimitive(source.error))};不能据此判断无记录。\n`);
321
+ continue;
322
+ }
323
+ if (source.status === "unknown") {
324
+ parts.push("> 返回结构未知,无法确认记录数。\n");
325
+ continue;
326
+ }
327
+ if (scope === "top") {
328
+ parts.push(`> 本次返回${source.returnedCount}条。${escapeCell(formatPrimitive(source._periodNote))}\n`);
329
+ if (source.empty === true)
330
+ parts.push("> 空结果:本次股东榜单查询无记录。\n");
331
+ if (Array.isArray(source.holderList))
332
+ parts.push(renderItemsTable(source.holderList, title));
333
+ if (Array.isArray(source.timeList))
334
+ parts.push(renderItemsTable(source.timeList, "可选期次 timeList"));
335
+ }
336
+ else {
337
+ parts.push(renderMeta(source));
338
+ if (source.empty === true)
339
+ parts.push("> 空结果:本次参股控股查询无记录。\n");
340
+ else if (Array.isArray(source.items) && source.items.length === 0)
341
+ parts.push("> 当前页无记录,不代表该来源没有记录。\n");
342
+ if (Array.isArray(source.items))
343
+ parts.push(renderItemsTable(source.items, title));
344
+ }
345
+ }
346
+ return parts.join("\n").replace(/\n{3,}/g, "\n\n");
347
+ }
348
+ if (toolName === "get_company_announcement" && isPlainObject(obj.sources)) {
349
+ for (const scope of ["stock", "mr"]) {
350
+ const source = obj.sources[scope];
351
+ if (!isPlainObject(source))
352
+ continue;
353
+ const title = scope === "stock" ? "上市公告" : String(source._queryType) === "0" ? "企业研报" : String(source._queryType) === "1" ? "相关公告" : "公告研报";
354
+ parts.push(`## ${title}\n`);
355
+ if (scope === "mr" && source._queryType !== undefined)
356
+ parts.push(`> 查询类型:type=${source._queryType}(${title});续查保持 --type ${source._queryType}。\n`);
357
+ if (source.status === "error") {
358
+ parts.push(`> 查询失败:${escapeCell(formatPrimitive(source.error))};不能据此判断该来源无记录。\n`);
359
+ }
360
+ else if (source.status === "unknown") {
361
+ parts.push("> 返回结构未知,无法确认该来源记录数。\n");
362
+ }
363
+ else {
364
+ parts.push(renderMeta(source));
365
+ if (source.empty === true)
366
+ parts.push(`> 空结果:未发现${title}记录。\n`);
367
+ else if (Array.isArray(source.items) && source.items.length === 0)
368
+ parts.push("> 当前页无记录,不代表该来源没有记录。\n");
369
+ else if (Array.isArray(source.items))
370
+ parts.push(renderItemsTable(source.items, title));
371
+ }
372
+ }
373
+ return parts.join("\n").replace(/\n{3,}/g, "\n\n");
374
+ }
306
375
  // 顶层字段
307
376
  const topFields = renderTopFields(obj);
308
377
  parts.push(topFields);
@@ -0,0 +1,33 @@
1
+ /** OA2 list labels preserve the provider's date/unit/role semantics. */
2
+ export function renderOA2Items(obj, toolName) {
3
+ let columns;
4
+ switch (toolName) {
5
+ case 'get_historical_environmental_penalty':
6
+ columns = [['Id', '记录标识'], ['CaseNo', '决定书文号'], ['PunishDate', '处罚日期'], ['IllegalType', '违法类型'], ['PunishGov', '处罚单位'], ['PunishAmt', '处罚金额(元)']];
7
+ break;
8
+ case 'get_labor_arbitration':
9
+ columns = [['CaseNo', '案号'], ['Applicant', '申请人'], ['Respondent', '被申请人']];
10
+ if (obj._notice_type === 'court')
11
+ columns.push(['CaseReason', '案由'], ['PublishOrg', '发布机构'], ['PublishDate', '开庭日期']);
12
+ else
13
+ columns.push(['PublishDate', '发布日期']);
14
+ break;
15
+ case 'get_prelitigation_mediation':
16
+ columns = [['CaseNo', '案号'], ['Court', '法院'], ['PunishDate', '立案日期'], ['CaseReason', '案由'], ['RoleList', '当事人分组(上游代码)']];
17
+ break;
18
+ default: return undefined;
19
+ }
20
+ const items = Array.isArray(obj.items) ? obj.items : [];
21
+ if (!items.length)
22
+ return '';
23
+ const cell = (v) => String(v ?? '').replace(/\|/g, '\\|').replace(/\r?\n/g, ' ') || '—';
24
+ const lines = ['| ' + columns.map(([, title]) => title).join(' | ') + ' |', '| ' + columns.map(() => '---').join(' | ') + ' |'];
25
+ for (const row of items) {
26
+ lines.push('| ' + columns.map(([key]) => {
27
+ if (key !== 'RoleList')
28
+ return cell(row[key]);
29
+ return cell((row.RoleList ?? []).map((role) => `类型代码 ${role.RoleType}:${role.RoleItemList.join('、')}`).join(';'));
30
+ }).join(' | ') + ' |');
31
+ }
32
+ return lines.join('\n') + '\n';
33
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tyc-cli",
3
- "version": "0.3.10",
4
- "description": "天眼查 AI CLI — 162 个业务语义聚合工具 · 默认 Shared Core 调用 · 兼容 MCP transport",
3
+ "version": "0.3.11",
4
+ "description": "天眼查 AI CLI — 165 个业务语义聚合工具 · 默认 Shared Core 调用 · 兼容 MCP transport",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
7
  "tyc": "dist/index.js"