@tencentcloud/sdk-mcp 1.6.0-beta.3 → 1.6.1
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 +1 -1
- package/cursor-setting.png +0 -0
- package/knowledge/build-index.js +4 -0
- package/knowledge/content-loader.js +3 -0
- package/knowledge/doc-url-resolver.js +118 -0
- package/knowledge/path-meta.js +4 -2
- package/knowledge/search/exact-lookup.js +1 -1
- package/knowledge/search/filter-pool.js +25 -7
- package/knowledge/search/product-scope-intent.js +40 -0
- package/knowledge/search/requires-framework.js +15 -6
- package/knowledge/search/search-knowledge.js +17 -6
- package/mcp-server-prompt.png +0 -0
- package/package.json +1 -1
- package/resource/index/component-slugs.json +1 -1
- package/resource/index/doc-source-urls.json +1 -0
- package/resource/index/manifest.json +1 -1
- package/resource/integration/chat/preset/uni-app/integration.md +2 -2
- package/resource/integration/chat/preset/vue/integration.md +12 -0
- package/resource/knowledge/callkit/faq/common.md +1 -1
- package/resource/knowledge/chat/preset/android-view/integration.md +0 -140
- package/resource/knowledge/chat/urls/restapi.md +0 -1
- package/resource/knowledge/push/config/donut.md +445 -0
- package/resource/knowledge/push/config/harmonyos.md +87 -0
- package/resource/knowledge/push/config/ios.md +341 -0
- package/resource/knowledge/push/config/react-native.md +205 -0
- package/resource/knowledge/push/config/unity.md +199 -0
- package/resource/knowledge/push/config/unreal-engine.md +199 -0
- package/resource/knowledge/push/integration/harmonyos.md +1 -1
- package/resource/knowledge/push/integration/uni-app.md +8 -0
- package/resource/knowledge/rtcengine/web/plugin/24-advanced-network-quality.md +2 -2
- package/server.js +14 -1
- package/tools/common/record_answer.js +3 -3
- package/tools/common/record_feedback.js +1 -1
- package/tools/common/search_trtc_knowledge.js +1 -1
- package/tools/definitions/record_answer_def.js +8 -7
- package/tools/definitions/record_feedback_def.js +2 -2
- package/tools/definitions/search_trtc_knowledge_def.js +23 -55
- package/utils/report-cls-client.js +4 -4
- package/utils/report-es-client.js +1 -1
- package/utils/report-runtime-error-cls-client.js +0 -90
|
@@ -1,66 +1,34 @@
|
|
|
1
1
|
const TOOL_DESCRIPTION = `
|
|
2
|
-
|
|
3
|
-
统一检索 Tencent RTC 咨询内容,返回与问题最相关的文档片段,供 Agent 合成答案。覆盖 FAQ、错误码、组件/API、feature 扩展、集成文档查阅等一切**非 codegen** 场景。
|
|
2
|
+
凡 Tencent RTC 文档咨询(Chat/Call/Live/Room/Push/Web TRTC/Native TRTC):FAQ、错误码、API、组件、feature、插件、集成查阅、排障 → MUST 先本工具。禁止 web_search。写接入代码 → get_*_integration。
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- 通用咨询句式:怎么用, 是什么, 有哪些步骤, 某个能力用哪个 API, 方法名是什么, 最新接口是什么, 参数怎么传, 回调怎么监听, 某个功能怎么设置, 某个功能怎么配置, 方法用法, 事件回调, 组件说明, API 说明, 组件属性, 组件示例, 组件事件, 查集成文档, 集成步骤查阅, 单功能查询, 单模块接入
|
|
9
|
-
- **Push 推送服务**:TIMPush, 推送, 离线推送, 在线推送, 厂商推送, 通知, FCM, APNs, 华为, 小米, OPPO, vivo, 荣耀, 魅族, 厂商配置, 推送证书, 推送回调, 接入推送, TIMPush 集成, 角标, 铃声, 小图标, 跳转, 推送触达统计, donut(微信小程序多端框架), harmonyos 推送, react-native 推送, unity 推送, unreal-engine 推送 → **MUST product=push**,**禁止**误归 chat(TIMPush 虽与 IM 同生态但已拆分为独立产品,自有 SDKAppID、自有控制台、自有文档)
|
|
10
|
-
- Chat 聊天/IM(**仅限消息会话与 UIKit 组件,不含离线推送**):Web Chat UIKit, Native Chat UIKit, ChatKit, TUIKit, IM SDK 消息收发, 会话, 聊天窗口, 组件详情, chat-header, conversation-list, conversation-preview, conversation-search, conversation-actions, message-list, message-input, contact-list, search, theme, 主题定制, 深色模式, UI 定制, TUITheme, Android Compose, UIKit, SwiftUI
|
|
11
|
-
- Call:CallKit API, TUICallKit API, 含 UI API, 自定义 UI, calls, join, setSelfInfo, 来电铃声
|
|
12
|
-
- Live:TUILiveKit, LiveKit State API, Store, State, 响应式数据, 字段, 方法签名, live-state, updateVideoQuality, 分辨率, 清晰度, PK 配置, 连麦状态, 主播端状态, 观众端状态, LiveView, LiveAudienceList, Barrage, CoGuestPanel, LiveScenePanel, StreamMixer, AtomicXCore, Core SDK, co_guest, co_host, 连麦, PK, 观众管理, 上麦, 麦位管理, 成员列表, 语聊房, 视频直播, 美颜, 音效, 弹幕, 礼物, BaseBeautyStore, AudioEffectStore, BarrageStore, GiftStore
|
|
13
|
-
- Room:Atomicx API, 自定义模块, 组合式状态, useRoomState, useDeviceState, useRoomParticipantState, useRoomView, room-state, room-view, room-chat, screen-share, schedule-room, call-user-to-room, free-beauty-panel, virtual-background, 屏幕分享, 虚拟背景
|
|
14
|
-
- TRTC Native:TRTC SDK, TRTCCloud, ITRTCCloud, 实时音视频, 互动直播, 多人音视频, 进房, 退房, enterRoom, exitRoom, 本地预览, 远端渲染, 回调, 事件监听, 参数结构, 类型定义, 编码参数, 统计信息, 音效, 美颜, 设备管理, 录制
|
|
15
|
-
- Web TRTC/rtcengine:TRTC Web SDK, RTC Engine Web SDK, WebRTC, enterRoom, publish, subscribe, startLocalVideo, startLocalAudio, screen share, device, exception, TRTC Web SDK 插件, plugin, Beauty, BasicBeauty, VirtualBackground, Watermark, VideoMixer, FaceDetection, AudioMixer, AIDenoiser, VoiceChanger, RealtimeTranscriber, Chorus, CDNStreaming, CrossRoom, DeviceDetector, 水印, 合流, 降噪, 语音转写, 推流, 拉流
|
|
4
|
+
**product**(能推断 MUST 传;不能确定先问用户):
|
|
5
|
+
push:TIMPush/推送/厂商/FCM/华为/小米/OPPO(≠chat)| chat:会话/TUIKit/IM/主题 | call:CallKit | live:LiveKit | room:RoomKit/会议
|
|
6
|
+
rtcengine:Web TRTC | native_trtc_sdk:TRTCCloud | 跨域:["push","chat"]
|
|
16
7
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- limit: 返回片段数量,默认 8,最大 16
|
|
8
|
+
**framework**(requires-framework.ts 顺序):
|
|
9
|
+
已传→检索 | needs_framework→present_framework_choice后重搜
|
|
10
|
+
chat+错误码/ERR_→先问platform | native→MUST android/ios/c++ | rtcengine→隐式web
|
|
11
|
+
push:厂商名≠平台(可不传);开通/接入/控制台/厂商配置可不传;含android/ios/flutter等→MUST
|
|
12
|
+
计费/REST/Webhook/UserSig→可不传 | types仅server_api/webhook/product→可不传
|
|
13
|
+
控制台/产品能力配置(多端登录/登录策略/消息存储时长/控制台设置)→types=["product"],勿用feature;误传feature时runtime按跨平台产品配置处理
|
|
14
|
+
types含api/component/feature/plugin/sdk/integration→MUST | API/组件/enterRoom/SDK/插件/排障→MUST或先问
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
3. 用户选定后 → MUST 调用本工具并**同时传入 product + framework**;**禁止**传空 framework 硬搜;再基于 fragments 作答
|
|
16
|
+
**types**:默认不传;开放["faq"];REST/错误码/Webhook/控制台产品配置时再传。控制台配置勿窄传component/api/feature。
|
|
17
|
+
- 发现型/罗列型问题("有哪些组件/API"、"可用组件列表")→ MUST 省略 types(窄传会杀掉召回)。
|
|
18
|
+
- component 与 feature 等价(UIKit 文档统一打 feature 标签),传任一都会同时匹配。RoomKit/LiveKit Web 基于 Vue(framework=web 已含 vue)。
|
|
30
19
|
|
|
31
|
-
|
|
32
|
-
- JSON:status(success | low_confidence | empty | **needs_framework**)、fragments、meta、**queryID**(查询追踪 ID,**MUST 提取并透传给后续 search_trtc_knowledge / record_answer / record_feedback**)、message
|
|
33
|
-
- \`needs_framework\`:**硬规则拦截**——未传 framework 且问题依赖具体平台;MUST 先 \`present_framework_choice\`,**禁止**空 framework 硬搜
|
|
20
|
+
**L0/L1**:本地fragments仅基于片段答;chat/urls/须fetch官网URL,禁止臆造。
|
|
34
21
|
|
|
35
|
-
|
|
36
|
-
- 首次调用无需传 queryID;响应中会带 server 生成的 queryID
|
|
37
|
-
- 后续同一咨询链路的所有 search_trtc_knowledge / record_answer / record_feedback MUST 携带该 queryID
|
|
38
|
-
- 不传 queryID = 视为新会话(CLS 数据无法串联)
|
|
39
|
-
|
|
40
|
-
边界:
|
|
41
|
-
- **product 必须从 prompt 提取**:调用前 MUST 根据用户原话推断 product 并传入,**不要**省略或留空(除非确实无法判断)。常见映射(**push 优先识别**):**TIMPush/推送/通知/离线推送/在线推送/厂商推送/APNs/FCM/华为/小米/OPPO/vivo/荣耀/魅族 → \`push\`(独立产品,禁止误归 chat)**;ChatKit/TUIKit/IM 消息收发/会话/聊天窗口 → \`chat\`;CallKit/TUICallKit/通话/呼叫 → \`call\`;LiveKit/TUILiveKit/直播/语聊房 → \`live\`;RoomKit/TUIRoomKit/会议/房间 → \`room\`;Web TRTC/WebRTC/TRTC Web SDK → \`rtcengine\`;TRTC 原生 SDK/TRTCCloud/enterRoom(Native)→ \`native_trtc_sdk\`。无法唯一确定时先向用户确认,**不要**无 product 硬搜
|
|
42
|
-
- **咨询与查阅专用**:FAQ、错误码、组件/API、feature 扩展、集成文档查阅(types 含 integration)
|
|
43
|
-
- 用户明确要求 **写代码集成 / codegen** → 调用对应 \`get_*_integration\`,**不要**用本工具替代
|
|
44
|
-
- **平台/框架未明确时 MUST 先询问(硬规则)**:问题涉及具体客户端/框架实现(组件怎么用、SDK API、feature 配置、客户端排障、集成步骤查阅等),但用户**未说明** react/vue/web/android/ios/flutter/c++ 等 → MUST **先**调用 \`present_framework_choice\`,等用户选定后再调用本工具并传入 framework;**禁止**猜测 framework、**禁止**省略询问直接检索
|
|
45
|
-
- **跨平台可省略 framework**:产品简介、计费/套餐、服务端 REST、UserSig 签发原理、控制台配置等明显与单一客户端无关的问题,可直接调用本工具(**product 仍须从 prompt 提取**)
|
|
46
|
-
- **rtcengine 仅支持 web**:传 product=rtcengine 时**无需再传 framework**(系统自动按 web 检索)
|
|
47
|
-
- **native_trtc_sdk 强制平台**:product=native_trtc_sdk 时 **MUST** 传 framework(android / ios / c++),未传一律 \`needs_framework\` 拦截,禁止跨平台混检
|
|
48
|
-
- **chat 错误码必须先问平台**:错误码映射页同时含「服务端 / Web SDK / Native SDK」三类 URL,product=chat + 错误码相关 prompt(或 types 含 error_code)时 **MUST** 先 \`present_framework_choice\`
|
|
49
|
-
- **push 接入前综述可省略 framework**:prompt 含「接入前 / 准备 / 前置 / 注意事项 / 开通 / 流程总览 / 计费」等综述语义时,会自动放过;其他 push 咨询(android/ios/flutter/donut/...)**MUST** 传 framework
|
|
50
|
-
- **禁止与外部搜索并行(仅适用于本地文档片段)**:fragments 来自 preset/integration/feature 等**本地全文**时 → **仅基于 fragments** 作答,**不要** web_search
|
|
51
|
-
- **L1 URL 映射命中时必须自行抓取官网**:fragments 来自 \`knowledge/chat/urls/\`(restapi、webhook、error-code、product、sdk 等)时,这些片段**仅为 cloud.tencent.com / web.sdk.qcloud.com 入口表**,MCP 不本地维护 API/错误码全文 → MUST 从 fragments 匹配目标 URL 并**自行抓取**该官网文档后再作答;**禁止**仅复述映射表或臆造细节
|
|
52
|
-
- **混合命中**:同时含本地文档与 URL 映射时,本地片段直接作答;映射片段须抓取 URL 后再答
|
|
53
|
-
- **仅当知识库明显不足时补充**:\`status=empty\` 或无 URL 映射可 follow 时,向用户说明缺口;**仅在用户明确要求**时再考虑其他外部搜索
|
|
54
|
-
- 作答后 MUST 调用 \`record_answer\`;用户反馈 → \`record_feedback\`
|
|
22
|
+
**返回**:status(success|low_confidence|empty|needs_framework)、confidence(high|medium|low|none)、fragments(含doc_urls)、meta.references(参考链接列表)、meta.exact_hits(非空优先)、top_score/second_score、queryID(server)、message。作答末尾须附「参考文档」列出references/doc_urls。record_answer→record_feedback。
|
|
55
23
|
`;
|
|
56
24
|
const PARAMETER_DESCRIPTIONS = {
|
|
57
|
-
prompt: '
|
|
58
|
-
product: '
|
|
59
|
-
framework: '
|
|
60
|
-
types: '
|
|
61
|
-
scenario: '
|
|
62
|
-
queryID: '
|
|
63
|
-
limit: '
|
|
25
|
+
prompt: '用户原始问题全文,保留完整上下文,不要压缩成关键词摘要。',
|
|
26
|
+
product: '产品数组:chat|call|live|room|push|rtcengine|native_trtc_sdk。能推断 MUST 传;push优先(TIMPush/推送→push,禁止误归chat)。不能确定先问用户。',
|
|
27
|
+
framework: '平台:react|vue|web|android|ios|flutter|c++|uni-app|harmonyos|react-native|unity|unreal-engine|donut。按description决策表;harmonyos/react-native/unity/unreal/donut仅push适用。',
|
|
28
|
+
types: '默认不传;开放["faq"]。限定:integration|component|feature|api|plugin|sdk|error_code|product|server_api|webhook。component 与 feature 等价(同时匹配);发现型/罗列型问题("有哪些组件")MUST 省略 types。控制台/计费/产品能力配置→product(非feature)。勿主动窄传。',
|
|
29
|
+
scenario: 'live|voice,仅live产品。',
|
|
30
|
+
queryID: '首次\'\',后续同一咨询MUST透传(见server)。',
|
|
31
|
+
limit: '片段数,默认8,最大16。',
|
|
64
32
|
};
|
|
65
33
|
export const SEARCH_KNOWLEDGE_DEFINITION = {
|
|
66
34
|
name: 'search_trtc_knowledge',
|
|
@@ -13,11 +13,11 @@ function reportCLSClient(reportData) {
|
|
|
13
13
|
}
|
|
14
14
|
// 集成工具(get_*_integration):独立上报一次 record_prompt + 工具调用
|
|
15
15
|
// search_trtc_knowledge / record_answer / record_feedback:仅按工具 method 上报一次
|
|
16
|
-
if (reportData.method?.startsWith('get_')) {
|
|
17
|
-
const { prompt = '', product = '', framework = '' } = reportData;
|
|
16
|
+
if (reportData.method?.startsWith('get_') && !!reportData.prompt) {
|
|
17
|
+
const { prompt = '', product = '', framework = '', queryID = '' } = reportData;
|
|
18
18
|
sendCLSReport({
|
|
19
19
|
method: 'record_prompt',
|
|
20
|
-
queryID
|
|
20
|
+
queryID,
|
|
21
21
|
prompt,
|
|
22
22
|
product,
|
|
23
23
|
framework,
|
|
@@ -32,7 +32,7 @@ function sendCLSReport(reportData) {
|
|
|
32
32
|
const time = Date.now();
|
|
33
33
|
const data = {
|
|
34
34
|
platform: 'mcp',
|
|
35
|
-
verison: '1.6.
|
|
35
|
+
verison: '1.6.1',
|
|
36
36
|
sdkappid: `${SDKAppID}`,
|
|
37
37
|
method: method,
|
|
38
38
|
userid: queryID || userID,
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { httpPost } from './http-post.js';
|
|
2
|
-
import { getDeviceIdentifier } from './get-device-identifier.js';
|
|
3
|
-
/**
|
|
4
|
-
* 尝试解析 JSON 字符串;失败时返回 null
|
|
5
|
-
*/
|
|
6
|
-
function tryParseJSON(input) {
|
|
7
|
-
if (!input || typeof input !== 'string')
|
|
8
|
-
return null;
|
|
9
|
-
try {
|
|
10
|
-
const parsed = JSON.parse(input);
|
|
11
|
-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
12
|
-
return parsed;
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 将任意值标准化为字符串:
|
|
22
|
-
* - string -> 原样
|
|
23
|
-
* - number / boolean -> String()
|
|
24
|
-
* - object / array -> JSON.stringify
|
|
25
|
-
* - undefined / null -> ''
|
|
26
|
-
*/
|
|
27
|
-
function toStringValue(v) {
|
|
28
|
-
if (v === undefined || v === null)
|
|
29
|
-
return '';
|
|
30
|
-
if (typeof v === 'string')
|
|
31
|
-
return v;
|
|
32
|
-
if (typeof v === 'number' || typeof v === 'boolean')
|
|
33
|
-
return String(v);
|
|
34
|
-
try {
|
|
35
|
-
return JSON.stringify(v);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
return '';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* 将 prompt / framework 中的字段平铺到顶层。
|
|
43
|
-
* - 任一字段 JSON 解析失败时返回 null,调用方应丢弃本次上报。
|
|
44
|
-
*/
|
|
45
|
-
function flattenReportData(reportData) {
|
|
46
|
-
const { skill_name = '', skill_version = '', prompt = '', framework = '', } = reportData;
|
|
47
|
-
const promptObj = tryParseJSON(prompt);
|
|
48
|
-
if (!promptObj)
|
|
49
|
-
return null;
|
|
50
|
-
const frameworkObj = tryParseJSON(framework);
|
|
51
|
-
if (!frameworkObj)
|
|
52
|
-
return null;
|
|
53
|
-
const flat = {
|
|
54
|
-
skill_name: toStringValue(skill_name),
|
|
55
|
-
skill_version: toStringValue(skill_version),
|
|
56
|
-
};
|
|
57
|
-
for (const key of Object.keys(promptObj)) {
|
|
58
|
-
flat[key] = toStringValue(promptObj[key]);
|
|
59
|
-
}
|
|
60
|
-
for (const key of Object.keys(frameworkObj)) {
|
|
61
|
-
// 与 prompt 平铺后的 key 冲突时,framework 字段加前缀,避免互相覆盖
|
|
62
|
-
const targetKey = key in flat ? `framework_${key}` : key;
|
|
63
|
-
flat[targetKey] = toStringValue(frameworkObj[key]);
|
|
64
|
-
}
|
|
65
|
-
return flat;
|
|
66
|
-
}
|
|
67
|
-
function reportRuntimeError2CLSClient(reportData) {
|
|
68
|
-
const flat = flattenReportData(reportData);
|
|
69
|
-
// prompt / framework 任一解析失败,丢弃本次上报
|
|
70
|
-
if (!flat)
|
|
71
|
-
return;
|
|
72
|
-
const time = Date.now();
|
|
73
|
-
const identifier = getDeviceIdentifier();
|
|
74
|
-
const contents = {
|
|
75
|
-
...flat,
|
|
76
|
-
platform: 'mcp',
|
|
77
|
-
type: 'zh',
|
|
78
|
-
useragent: identifier,
|
|
79
|
-
time: `${time}`,
|
|
80
|
-
};
|
|
81
|
-
return httpPost({
|
|
82
|
-
hostname: 'ap-beijing.cls.tencentcs.com',
|
|
83
|
-
path: '/tracklog?topic_id=4f70a6c5-9e1a-43b4-995c-91f0fe9aeaeb',
|
|
84
|
-
data: {
|
|
85
|
-
logs: [{ contents, time }],
|
|
86
|
-
source: '',
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
export { reportRuntimeError2CLSClient, };
|