@tencent-rtc/mcp 1.7.5 → 1.7.7

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +60 -52
  3. package/index.js +23 -1
  4. package/knowledge/chunker.js +1 -0
  5. package/knowledge/path-meta.js +12 -1
  6. package/knowledge/search/search-core.js +22 -4
  7. package/knowledge/search/search-knowledge.js +1 -1
  8. package/package.json +1 -1
  9. package/resource/index/manifest.json +1 -1
  10. package/server-config.js +20 -6
  11. package/server.js +35 -29
  12. package/tools/common/get_usersig.js +1 -1
  13. package/tools/definitions/get_native_call_uikit_integration_def.js +13 -7
  14. package/tools/definitions/get_native_callkit_core_integration_def.js +42 -31
  15. package/tools/definitions/get_native_chat_uikit_integration_def.js +11 -4
  16. package/tools/definitions/get_native_live_uikit_integration_def.js +21 -15
  17. package/tools/definitions/get_native_livekit_core_integration_def.js +11 -4
  18. package/tools/definitions/get_usersig_def.js +18 -11
  19. package/tools/definitions/get_web_call_uikit_integration_def.js +11 -4
  20. package/tools/definitions/get_web_chat_uikit_integration_def.js +11 -4
  21. package/tools/definitions/get_web_live_uikit_integration_def.js +11 -4
  22. package/tools/definitions/get_web_room_core_integration_def.js +16 -13
  23. package/tools/definitions/get_web_room_uikit_integration_def.js +11 -4
  24. package/tools/definitions/integration-boundary.js +9 -5
  25. package/tools/definitions/present_framework_choice_def.js +20 -20
  26. package/tools/definitions/search_trtc_knowledge_def.js +47 -27
  27. package/tools/definitions/submit_feedback_def.js +18 -14
  28. package/utils/normalize-error.js +13 -0
  29. package/utils/report-cls-client.js +2 -2
  30. package/utils/report-es-client.js +1 -1
@@ -3,15 +3,22 @@ const TOOL_DESCRIPTION = `
3
3
  Purpose:
4
4
  Return Web Room UIKit preset integration docs for the main meeting entry page, room page, and default meeting app flow.
5
5
 
6
- Typical use cases:
6
+ When to call (MUST):
7
+ - User explicitly asks for runnable project integration code or concrete implementation steps.
8
+
9
+ When NOT to call:
10
+ - Pure feature Q&A, documentation lookup, API/component explanation, troubleshooting.
11
+
12
+ Scope details:
13
+
7
14
  Web Room UIKit, TUIRoomUIKit, Atomicx, Vue, preset UI, default meeting app, meeting app, home.vue, room.vue, meeting entry page, meeting room page, H5 meeting, PC meeting, integrate Room UIKit
8
15
 
9
- Input:
16
+ Inputs:
10
17
  - framework: vue
11
18
  - prompt: The user's original question in full. Keep the full context. Do not compress it into keywords or a short summary.
12
19
 
13
- Returns:
14
- - content: [{ type: 'text', text: documentation content or explanatory text }]
20
+ Outputs:
21
+ - content: [{ type: 'text', text: Documentation body or explanatory text }]
15
22
 
16
23
  Boundaries:
17
24
  - This tool is for preset UI integration. It is not for Atomicx API details or custom single-feature modules.
@@ -1,6 +1,10 @@
1
- /** Shared boundary text appended to integration tool descriptions. */
1
+ /** Shared Phase B boundary suffix for all get_* integration tools */
2
2
  export const INTEGRATION_BOUNDARY_SUFFIX = `
3
- - **Codegen only**: Call this tool only when the user explicitly wants integration code added into a project, wants you to implement the integration, or wants generated starter code.
4
- - **Consultation / lookup only** (how it works, what it is, setup steps, troubleshooting, API or component explanations) -> call \`search_trtc_knowledge\`, not this tool.
5
- - This tool belongs to the codegen flow: after answering, do **not** call \`finalize_answer\` or \`submit_feedback\` (those belong only to the \`search_trtc_knowledge\` flow).
6
- - **User-visible output rule (MUST)**: routing/tool choices above are internal only. Never expose text like "should call/first call/let me search/consultation-only/not codegen" to users; output conclusions and executable guidance directly.`;
3
+ - **Codegen only (MUST)**: Call this tool only when user explicitly asks for runnable integration/code implementation (for example: "integrate into my project", "write integration code", "give runnable code").
4
+ - **When NOT to call**: For pure Q&A, documentation lookup, API/component explanation, error troubleshooting, or "I just want to understand the approach first" requests, call \`search_trtc_knowledge\` instead.
5
+ - **Workflow split**: This tool belongs to codegen flow. After responding with integration/code content, do **NOT** call \`finalize_answer\` or \`submit_feedback\`.
6
+ - **User-visible output rule (MUST)**: Tool routing decisions are internal. Do not expose process text like "should call", "call this first", "let me search first", or "this is consultation, not codegen". Output only final actionable content.
7
+ - **Few-shot boundary**:
8
+ - Positive: "Use Vue to integrate Chat UIKit into my existing project and provide runnable code" -> call corresponding \`get_*_integration\`
9
+ - Negative: "What capabilities/components does Chat UIKit provide?" -> call \`search_trtc_knowledge\`
10
+ `;
@@ -1,36 +1,36 @@
1
1
  const TOOL_DESCRIPTION = `
2
2
  Purpose:
3
- Guide the user to pick a supported platform or framework when the request does not clearly specify one, before continuing with search_trtc_knowledge or an integration tool.
3
+ Collect platform/framework choice from user when the question requires client-side platform context.
4
4
 
5
- Typical use cases:
6
- platform choice, framework choice, pick a platform first, pick a framework first, platform not specified, framework not specified, integration guide, setup docs, quick start, API lookup, component lookup, feature lookup, how to configure, Chat UIKit integration, Call UIKit integration, Live UIKit integration, Room UIKit integration, CallKit API, LiveKit API, WebRTC SDK integration, Native TRTC SDK integration, react, vue, web, miniprogram, uni-app, flutter, android, ios, webrtc
5
+ When to call (MUST):
6
+ - User asks API/component/feature/client troubleshooting/integration guidance but does not specify platform.
7
+ - search_trtc_knowledge returns needs_framework.
8
+ - User requests explicit codegen/integration but platform is not specified.
7
9
 
8
- Trigger examples:
9
- - Get the Chat UIKit integration guide (React/Vue not specified)
10
- - How do I configure the CallKit ringtone (platform not specified)
11
- - How do I use a Chat UIKit component (Web/Native not specified)
12
- - How do I enable virtual background (product or platform not specified)
10
+ When NOT to call:
11
+ - Cross-platform product topics: pricing, product package, console-level product config.
12
+ - Server-side topics: REST API, webhook, UserSig principle.
13
+ - Platform is already explicitly provided by user.
13
14
 
14
- Input:
15
- - product: chat | call | live | room | rtcengine | native_trtc_sdk | push
15
+ Boundary:
16
+ - This tool only collects platform/framework; it does NOT return documentation content.
17
+ - After user chooses platform:
18
+ - Q&A / troubleshooting / doc lookup -> call search_trtc_knowledge with product + frameworks.
19
+ - Explicit codegen request -> call corresponding get_*_integration tool.
16
20
 
17
- Returns:
18
- - content: [{ type: 'text', text: selectable option list }]
19
-
20
- Boundaries:
21
- - This tool only collects the platform or framework choice. It does not return documentation content.
22
- - **Consultation chain (hard rule)**: API / component / feature / client troubleshooting / integration lookup without a platform -> MUST call this tool first, then search_trtc_knowledge with **product + frameworks**; do not skip.
23
- - **Codegen chain (hard rule)**: user wants integration code in a project but platform is unclear -> MUST call this tool first, then the matching get_*_integration tool.
24
- - Cross-platform general questions (billing, server REST, UserSig principles) unrelated to a single client -> search_trtc_knowledge directly without this tool (product still MUST be inferred from the prompt).
21
+ Few-shot:
22
+ - User: "How do I integrate Chat UIKit?" (no React/Vue) -> CALL present_framework_choice
23
+ - User: "How to configure CallKit ringtone?" (no platform) -> CALL present_framework_choice
24
+ - User: "How do I enable TIMPush vendor channel in console?" -> DO NOT call present_framework_choice
25
25
  `;
26
26
  const SELECTION_PROMPT_TEXT = `
27
- Show the supported platform or framework options directly to the user, ask them to pick one, and wait for their reply before calling any integration or lookup tool.
27
+ Please show available platform/framework options to user first. Continue with search or integration only after user selects one option.
28
28
  `;
29
29
  export const PRESENT_FRAMEWORK_CHOICE_DEFINITION = {
30
30
  name: 'present_framework_choice',
31
31
  description: TOOL_DESCRIPTION,
32
32
  selectionText: SELECTION_PROMPT_TEXT,
33
33
  parameter_descriptions: {
34
- product: 'Target product. Allowed values: chat | call | live | room | rtcengine | native_trtc_sdk | push.',
34
+ product: 'Target product. Allowed: chat | call | live | room | rtcengine | native_trtc_sdk | push.',
35
35
  },
36
36
  };
@@ -1,40 +1,60 @@
1
1
  const TOOL_DESCRIPTION = `
2
- For Tencent RTC documentation lookup (Chat / Call / Live / Room / Push / Web TRTC / Native TRTC): FAQ, error code, API, component, feature, plugin, integration lookup, troubleshooting -> MUST use this tool first. Do not use web_search. If the user explicitly wants integration code written, use the matching get_*_integration tool.
2
+ Purpose:
3
+ Use this tool as the default retrieval entry for Tencent RTC documentation and troubleshooting.
3
4
 
4
- **prompt must preserve the user's original question verbatim**: do NOT expand, paraphrase, rewrite, or append API usage / scenario details. Pass exactly what the user asked. If you want to add semantics (API/events/specific implementation), express it via structured params (types/frameworks/product) or search separately.
5
+ When to call (MUST):
6
+ - Technical Q&A: product capability, configuration, best practice, and documentation lookup.
7
+ - API lookup: API / component / event / parameter / error code.
8
+ - Troubleshooting: error, exception, failure, or compatibility issue.
9
+ - Integration reference lookup when user wants guidance/docs but does NOT explicitly ask for runnable code generation.
5
10
 
6
- **product** (if inferable, MUST pass; if not, ask first):
7
- push: TIMPush / push / vendor channel / FCM / Huawei / Xiaomi / OPPO (not chat) | chat: conversation / TUIKit / IM / theme
8
- call: CallKit | live: LiveKit | room: RoomKit / meeting | rtcengine: Web TRTC | native_trtc_sdk: TRTCCloud | cross-domain: ["push","chat"]
11
+ When NOT to call:
12
+ - Non-technical chat/greeting/small talk.
13
+ - User explicitly asks to generate or modify runnable integration code in project -> use corresponding get_*_integration tool.
9
14
 
10
- **frameworks** (same decision order as requires-framework.ts):
11
- If provided -> search. If response is needs_framework -> call present_framework_choice, then retry.
12
- chat + error code / ERR_ -> ask platform first | native_trtc_sdk -> MUST include one of android / ios / c++ | rtcengine -> implicit web
13
- push: vendor name alone is not a platform (framework optional); enablement / console / vendor config may omit framework; if android / ios / flutter etc. appear -> MUST pass framework
14
- billing / REST / Webhook / UserSig -> framework optional | if types only contain server_api / webhook / product -> framework optional
15
- console / product capability config (multi-device login, login policy, message storage, console settings) -> types=["product"], not feature; even if Agent passes feature, runtime treats as cross-platform product config
16
- if types include api / component / feature / plugin / sdk / integration -> framework required | API / component / enterRoom / SDK / plugin / troubleshooting usually require framework or a follow-up question
15
+ Hard input rule:
16
+ - prompt MUST preserve original user question verbatim. Do NOT expand, rewrite, or inject extra assumptions.
17
17
 
18
- **types**: usually omit. Open default narrow case: ["faq"]. Pass explicit types only for REST / error code / Webhook / console product config questions. Do not proactively narrow to component/api/feature for console settings.
19
- - Discovery / listing questions ("what components are available", "有哪些组件/API") -> MUST omit types (narrowing kills recall).
20
- - component and feature are equivalent (UIKit docs are tagged feature); passing either matches both. RoomKit / LiveKit Web are Vue-based (framework=web already covers vue).
18
+ Product routing:
19
+ - push: TIMPush / push / vendor channel / FCM / APNs / Huawei / Xiaomi / OPPO / vivo
20
+ - chat: conversation / TUIKit / ChatKit / IM / theme
21
+ - call: CallKit / call
22
+ - live: LiveKit / live streaming / voice room
23
+ - room: RoomKit / meeting
24
+ - rtcengine: Web TRTC / WebRTC
25
+ - native_trtc_sdk: TRTCCloud / Native SDK / client SDK
26
+ - Multi-domain is allowed (e.g. ["push","chat"]).
21
27
 
22
- **L0/L1**: For local fragments, answer only from the returned text. For chat/urls/ results, fetch the official URL before stating facts. Never invent content.
28
+ Framework policy:
29
+ - If client platform is required but missing, call present_framework_choice first.
30
+ - If status=needs_framework, MUST collect framework first and then re-search.
31
+ - Framework is optional for cross-platform topics (pricing, REST, webhook, product-level console config).
23
32
 
24
- **Returns**: status, confidence, fragments(doc_urls), meta.references/exact_hits, top_score/second_score, queryID, message, meta.answer_contract. The answer MUST follow answer_contract (user-actionable, make unconfirmed points explicit); deliver a complete user-visible answer — do not artificially shorten; never output system jargon such as "matched fragments / search results / confidence", but keep a "References" section at the end listing references/doc_urls.
33
+ Types policy:
34
+ - Default: do not pass types.
35
+ - Pass types only for clearly scoped cases (REST / webhook / error_code / product-level config).
36
+ - For discovery/listing questions (e.g. "what components/APIs are available"), keep types empty to avoid over-filtering.
25
37
 
26
- **Post-answer workflow**: After the final answer is drafted, MUST call \`finalize_answer\` with the same prompt + queryID before replying. Append its follow-up text. On explicit follow-up feedback, call \`submit_feedback\`.
38
+ Few-shot:
39
+ - User: "What does TRTC error 10015 mean?" -> CALL search_trtc_knowledge
40
+ - User: "What components are configurable in RoomKit?" -> CALL search_trtc_knowledge
41
+ - User: "Integrate Web Chat UIKit into my React project and provide runnable code" -> Prefer get_*_integration (not this tool first)
42
+
43
+ Return contract:
44
+ - Returns status/confidence/fragments/meta.references/queryID/answer_contract.
45
+ - Before final user reply, MUST call finalize_answer.
46
+ - After explicit follow-up feedback, MUST call submit_feedback.
27
47
  `;
28
48
  const PARAMETER_DESCRIPTIONS = {
29
- prompt: "The user's original question VERBATIM. MUST pass through as-is; do NOT expand, rewrite, or append API usage/scenarios/follow-ups. If extra semantics are needed, use structured params like types/frameworks instead.",
30
- product: 'Product array: chat | call | live | room | push | rtcengine | native_trtc_sdk. If inferable, MUST pass it. Push takes priority for TIMPush / push topics and must not be misrouted to chat. Common live keywords: LiveKit / live streaming / voice room / TUILiveKit / AtomicXCore / host streaming / watch live. If uncertain, ask the user first.',
31
- frameworks: 'Platform array: react | vue | web | miniprogram | android | ios | flutter | c++ | uni-app | harmonyos | react-native | unity | unreal-engine | donut. Multiple platforms can be passed for cross-platform lookup. For CallKit, TUICallKit is best searched separately by react/vue, while TUICallEngine/TUICallEvent still map to web; use miniprogram for Mini Program. harmonyos / react-native / unity / unreal-engine / donut are only valid for push. If frameworks are missing and the question depends on a specific client platform, you MUST call present_framework_choice first, then retry.',
32
- types: 'Usually omit. Allowed values: integration | component | feature | api | plugin | sdk | faq | error_code | product | server_api | webhook. component and feature are equivalent (match both). Discovery/listing questions ("what components are available") MUST omit types. Console/billing/product-capability config -> product (not feature). Do not proactively over-narrow.',
33
- scenario: 'live | voice. Only valid for the live product.',
34
- queryID: "First call: ''. Follow-up calls in the same consultation MUST pass through the original queryID returned by the server.",
35
- ide: 'IDE name (cursor|claude-code|vscode|codebuddy|codex|trae|others). Required.',
36
- from: 'Empty string by default.',
37
- limit: 'Number of fragments. Default 8, maximum 16.',
49
+ prompt: 'Original user question, MUST be passed verbatim. Do not rewrite or extend. Use structured fields (product/frameworks/types) for extra constraints.',
50
+ product: 'Product array: chat|call|live|room|push|rtcengine|native_trtc_sdk. Infer and pass when confident. push has priority for TIMPush/push queries.',
51
+ frameworks: 'Framework/platform array: react|vue|web|miniprogram|android|ios|flutter|c++|uni-app|harmonyos|react-native|unity|unreal-engine|donut. If platform is required but missing, call present_framework_choice first.',
52
+ types: 'Optional filter. Allowed: integration|component|feature|api|plugin|sdk|error_code|product|server_api|webhook|faq. Keep empty for discovery/listing queries.',
53
+ scenario: 'live|voice, only for live product.',
54
+ queryID: 'First call can be empty string; all subsequent calls in same consultation MUST reuse the returned queryID.',
55
+ ide: 'IDE name: cursor|claude-code|vscode|codebuddy|codex|trae|others.',
56
+ from: 'Optional, default empty string.',
57
+ limit: 'Fragment count, default 8, max 16.',
38
58
  };
39
59
  export const SEARCH_KNOWLEDGE_DEFINITION = {
40
60
  name: 'search_trtc_knowledge',
@@ -1,23 +1,27 @@
1
1
  const TOOL_DESCRIPTION = `
2
2
  Purpose:
3
- Submit the user's reply to the finalize_answer follow-up.
3
+ Submit user feedback for the finalize_answer follow-up.
4
4
 
5
- When to call:
6
- - If the previous assistant response ended with the finalize_answer follow-up, check the next user reply for feedback before any normal response.
7
- - Positive: "Yes", "Solved", "Thanks", "OK", "yes", "resolved" -> resolved="1".
8
- - Negative: "No", "Not solved", "still not working", "no" -> resolved="0".
9
- - MUST call this tool before replying when feedback is explicit.
10
- - Never say feedback was submitted/recorded unless this tool was called.
11
- - Do NOT call for unclear replies or new unrelated questions.
5
+ When to call (hard rule):
6
+ - If previous assistant message ended with finalize_answer follow-up, inspect the next user reply first.
7
+ - If reply explicitly indicates solved/unsolved, MUST call this tool before any normal response.
8
+ - Do NOT call for unclear replies, unrelated new questions, or non-feedback messages.
12
9
 
13
- Input:
14
- - prompt: Original user question. Must match finalize_answer.
15
- - queryID: REQUIRED. Same queryID as search_trtc_knowledge/finalize_answer.
16
- - resolved: "1" for positive feedback, "0" for negative feedback.
10
+ Resolved mapping:
11
+ - resolved="1": Yes / 已解决 / 解决了 / 好的 / 谢谢 / OK / resolved
12
+ - resolved="0": No / 未解决 / 没解决 / 不行 / 还有问题 / still not working
13
+
14
+ Input contract:
15
+ - prompt: original user question, consistent with finalize_answer.
16
+ - queryID: REQUIRED, same queryID used by search_trtc_knowledge/finalize_answer.
17
+ - resolved: "1" or "0".
18
+
19
+ Output contract:
20
+ - Never claim feedback is submitted/recorded unless this tool has been called.
17
21
  `;
18
22
  const PARAMETER_DESCRIPTIONS = {
19
- prompt: 'Original user question. Must match finalize_answer.',
20
- framework: 'Reuse framework from the search_trtc_knowledge chain when available.',
23
+ prompt: 'Original user question. Must match finalize_answer prompt.',
24
+ framework: 'Reuse framework from current search_trtc_knowledge chain when available.',
21
25
  queryID: 'REQUIRED. Same queryID as search_trtc_knowledge/finalize_answer.',
22
26
  resolved: '"1" for positive feedback, "0" for negative feedback.',
23
27
  };
@@ -0,0 +1,13 @@
1
+ function normalizeError(error) {
2
+ if (error instanceof Error) {
3
+ return {
4
+ error_code: error.name || 'Error',
5
+ error_msg: error.message?.slice(0, 256) || 'Unknown error',
6
+ };
7
+ }
8
+ return {
9
+ error_code: 'UnknownError',
10
+ error_msg: String(error).slice(0, 256),
11
+ };
12
+ }
13
+ export { normalizeError, };
@@ -22,13 +22,13 @@ function reportCLSClient(reportData) {
22
22
  sendCLSReport(reportData);
23
23
  }
24
24
  function sendCLSReport(reportData) {
25
- const { SDKAppID: _SDKAppID } = ServerConfig.getInstance().getConfig();
25
+ const _SDKAppID = reportData.SDKAppID ? reportData.SDKAppID : ServerConfig.getInstance().getConfig()?.SDKAppID;
26
26
  const { SDKAppID = _SDKAppID, method = '', userID = '', framework = '', product = '', prompt = '', queryID = '', answer = '', feedback = '', info = '', ide = '', from = '', } = reportData;
27
27
  const identifier = getDeviceIdentifier();
28
28
  const time = Date.now();
29
29
  const data = {
30
30
  platform: 'mcp',
31
- verison: '1.7.5',
31
+ verison: '1.7.7',
32
32
  sdkappid: `${SDKAppID}`,
33
33
  method: method,
34
34
  userid: queryID || userID,
@@ -7,7 +7,7 @@ function reportESClient(reportData) {
7
7
  report: [
8
8
  {
9
9
  platform: 'mcp',
10
- version: '1.7.5',
10
+ version: '1.7.7',
11
11
  sdkappid: `${SDKAppID}`,
12
12
  method: method,
13
13
  userID: `${userID}`,