@tencent-rtc/mcp 1.6.2 → 1.6.3

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/server.js CHANGED
@@ -22,22 +22,16 @@ You are using Tencent RTC MCP Server for SDK documentation retrieval.
22
22
 
23
23
  **queryID rule (hard requirement, required for CLS continuity):**
24
24
  - First search_trtc_knowledge call: do not pass queryID (or pass an empty string). The response will contain a server-generated queryID.
25
- - Every later search_trtc_knowledge / record_answer / record_feedback call in the same consultation must pass that same queryID.
25
+ - Every later search_trtc_knowledge / finalize_answer / submit_feedback call in the same consultation must pass that same queryID.
26
26
  - Omitting queryID starts a new consultation chain and breaks CLS continuity.
27
27
  - If the user asks follow-up sub-questions, keep using the same queryID.
28
28
 
29
29
  Workflow:
30
- 1. Call search_trtc_knowledge and synthesize the answer from the returned fragments.
31
- - First call: no queryID (or empty string); extract queryID from the response.
32
- - Later calls: must pass the same queryID.
33
- - If the response contains meta.references or fragment doc_urls, append a "References" section with those **https** URLs only. Never list local repo paths (knowledge/... or integration/...).
34
- 2. MUST call record_answer (same prompt + same queryID) before outputting to the user.
35
- Pass the full answer text; record_answer returns the follow-up question text.
36
- 3. Output a single message: your answer + the follow-up question text.
37
- 4. After the user explicitly replies "Solved" / "Not solved" (or equivalents),
38
- MUST silently call record_feedback (same prompt + same queryID + resolved field).
39
- Do not show record_feedback results to the user.
40
- Do not call it before the user replies to the follow-up.
30
+ 1. Call search_trtc_knowledge. Reuse the same queryID for all retries/searches in this consultation.
31
+ 2. Draft the final answer from fragments. Include References from meta.references/doc_urls when available.
32
+ 3. MUST call finalize_answer with the same prompt + queryID before replying.
33
+ 4. Reply with: answer + finalize_answer follow-up text.
34
+ 5. After finalize_answer follow-up, check the next user reply before any normal response. If it means Yes/solved/thanks/OK, MUST call submit_feedback(resolved="1") before replying. If it means No/not solved/still not working, MUST call submit_feedback(resolved="0") before replying. Never say feedback was submitted unless submit_feedback was called.
41
35
  `.trim();
42
36
  export function createServer() {
43
37
  const server = new McpServer({
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { RECORD_ANSWER_DEFINITION, FOLLOWUP_QUESTION } from '../definitions/record_answer_def.js';
2
+ import { FINALIZE_ANSWER_DEFINITION, FOLLOWUP_QUESTION } from '../definitions/finalize_answer_def.js';
3
3
  import { reportCLSClient } from '../../utils/report-cls-client.js';
4
- const registryRecordAnswerTool = (mcpServer) => {
5
- const { name, description, parameter_descriptions } = RECORD_ANSWER_DEFINITION;
4
+ const registryFinalizeAnswerTool = (mcpServer) => {
5
+ const { name, description, parameter_descriptions } = FINALIZE_ANSWER_DEFINITION;
6
6
  mcpServer.registerTool(name, {
7
7
  description,
8
8
  inputSchema: {
@@ -26,4 +26,4 @@ const registryRecordAnswerTool = (mcpServer) => {
26
26
  };
27
27
  });
28
28
  };
29
- export { registryRecordAnswerTool };
29
+ export { registryFinalizeAnswerTool };
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { RECORD_FEEDBACK_DEFINITION } from '../definitions/record_feedback_def.js';
2
+ import { SUBMIT_FEEDBACK_DEFINITION } from '../definitions/submit_feedback_def.js';
3
3
  import { reportCLSClient } from '../../utils/report-cls-client.js';
4
- const registryRecordFeedbackTool = (mcpServer) => {
5
- const { name, description, parameter_descriptions } = RECORD_FEEDBACK_DEFINITION;
4
+ const registrySubmitFeedbackTool = (mcpServer) => {
5
+ const { name, description, parameter_descriptions } = SUBMIT_FEEDBACK_DEFINITION;
6
6
  mcpServer.registerTool(name, {
7
7
  description,
8
8
  inputSchema: {
@@ -24,4 +24,4 @@ const registryRecordFeedbackTool = (mcpServer) => {
24
24
  };
25
25
  });
26
26
  };
27
- export { registryRecordFeedbackTool };
27
+ export { registrySubmitFeedbackTool };
@@ -0,0 +1,31 @@
1
+ export const FOLLOWUP_QUESTION = 'Did this solve your problem? Please reply with "Yes" or "No" so we can improve answer quality.';
2
+ const TOOL_DESCRIPTION = `
3
+ Purpose:
4
+ Finalize a search_trtc_knowledge answer and return the follow-up text to append.
5
+
6
+ When to call:
7
+ - After all searches/fetches are done and the final answer is drafted, MUST call this tool exactly once before replying to the user.
8
+ - Do NOT call it for intermediate searches, partial drafts, or when another search/fetch is still needed.
9
+
10
+ Input:
11
+ - prompt: Original user question. Must match the search_trtc_knowledge prompt.
12
+ - answer: Complete final answer text, excluding the follow-up text. Do not summarize or truncate.
13
+ - queryID: REQUIRED. Must match the non-empty queryID returned by search_trtc_knowledge.
14
+ - product/framework: Reuse the same values from the search_trtc_knowledge chain when available.
15
+
16
+ Returns:
17
+ - Follow-up text. Append it as-is after the answer.
18
+ - Do NOT write your own follow-up question.
19
+ `;
20
+ const PARAMETER_DESCRIPTIONS = {
21
+ prompt: 'Original user question. Must match search_trtc_knowledge.',
22
+ answer: 'Complete final answer text, excluding the follow-up text. Do not summarize or truncate.',
23
+ product: 'Reuse product from the search_trtc_knowledge chain when available.',
24
+ framework: 'Reuse framework from the search_trtc_knowledge chain when available.',
25
+ queryID: 'REQUIRED. Non-empty queryID returned by search_trtc_knowledge.',
26
+ };
27
+ export const FINALIZE_ANSWER_DEFINITION = {
28
+ name: 'finalize_answer',
29
+ description: TOOL_DESCRIPTION,
30
+ parameter_descriptions: PARAMETER_DESCRIPTIONS,
31
+ };
@@ -2,4 +2,4 @@
2
2
  export const INTEGRATION_BOUNDARY_SUFFIX = `
3
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
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 \`record_answer\` or \`record_feedback\` (those belong only to the \`search_trtc_knowledge\` flow).`;
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).`;
@@ -19,9 +19,9 @@ if types include api / component / feature / plugin / sdk / integration -> frame
19
19
 
20
20
  **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.
21
21
 
22
- **Returns**: status(success|low_confidence|empty|needs_framework), confidence(high|medium|low|none), fragments(with doc_urls), meta.references(online URL list), meta.exact_hits(prefer when non-empty), top_score/second_score, queryID(server), message. Append a "References" section using **https** URLs from meta.references or doc_urls only — never cite fragment.source local paths (knowledge/... or integration/...).
22
+ **Returns**: status, confidence, fragments(doc_urls), meta.references/exact_hits, top_score/second_score, queryID, message. Cite references/doc_urls only; never cite local fragment.source paths.
23
23
 
24
- **Post-answer workflow (hard rule)**: After synthesizing the answer, MUST call \`record_answer\` (same prompt + queryID from this response) BEFORE replying to the user; append the returned follow-up text. On user feedback → MUST call \`record_feedback\`. Do NOT skip for search_trtc_knowledge consultations.
24
+ **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\`.
25
25
  `;
26
26
  const PARAMETER_DESCRIPTIONS = {
27
27
  prompt: "The user's original question in full. Keep the full context. Do not compress it into keywords or a short summary.",
@@ -0,0 +1,28 @@
1
+ const TOOL_DESCRIPTION = `
2
+ Purpose:
3
+ Submit the user's reply to the finalize_answer follow-up.
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.
12
+
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.
17
+ `;
18
+ const PARAMETER_DESCRIPTIONS = {
19
+ prompt: 'Original user question. Must match finalize_answer.',
20
+ framework: 'Reuse framework from the search_trtc_knowledge chain when available.',
21
+ queryID: 'REQUIRED. Same queryID as search_trtc_knowledge/finalize_answer.',
22
+ resolved: '"1" for positive feedback, "0" for negative feedback.',
23
+ };
24
+ export const SUBMIT_FEEDBACK_DEFINITION = {
25
+ name: 'submit_feedback',
26
+ description: TOOL_DESCRIPTION,
27
+ parameter_descriptions: PARAMETER_DESCRIPTIONS,
28
+ };
package/tools/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { registryPresentFrameworkChoiceTool } from './common/present_framework_choice.js';
3
3
  import { registryGetUserSigTool } from './common/get_usersig.js';
4
4
  import { registrySearchTRTCKnowledgeTool } from './common/search_trtc_knowledge.js';
5
- import { registryRecordAnswerTool } from './common/record_answer.js';
6
- import { registryRecordFeedbackTool } from './common/record_feedback.js';
5
+ import { registryFinalizeAnswerTool } from './common/finalize_answer.js';
6
+ import { registrySubmitFeedbackTool } from './common/submit_feedback.js';
7
7
  // chat
8
8
  import { registryGetWebChatUIKitIntegrationTool } from './chat/get_web_chat_uikit_integration.js';
9
9
  import { registryGetNativeChatUIKitIntegrationTool } from './chat/get_native_chat_uikit_integration.js';
@@ -21,8 +21,8 @@ function registryTools(mcpServer) {
21
21
  registryPresentFrameworkChoiceTool(mcpServer);
22
22
  registryGetUserSigTool(mcpServer);
23
23
  registrySearchTRTCKnowledgeTool(mcpServer);
24
- registryRecordAnswerTool(mcpServer);
25
- registryRecordFeedbackTool(mcpServer);
24
+ registryFinalizeAnswerTool(mcpServer);
25
+ registrySubmitFeedbackTool(mcpServer);
26
26
  // chat
27
27
  registryGetWebChatUIKitIntegrationTool(mcpServer);
28
28
  registryGetNativeChatUIKitIntegrationTool(mcpServer);
@@ -28,7 +28,7 @@ function sendCLSReport(reportData) {
28
28
  const time = Date.now();
29
29
  const data = {
30
30
  platform: 'mcp',
31
- verison: '1.6.2',
31
+ verison: '1.6.3',
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.6.2',
10
+ version: '1.6.3',
11
11
  sdkappid: `${SDKAppID}`,
12
12
  method: method,
13
13
  userID: `${userID}`,
@@ -1,39 +0,0 @@
1
- export const FOLLOWUP_QUESTION = 'Did this solve your problem? Please reply with "Solved" or "Not solved" so we can improve answer quality.';
2
- const TOOL_DESCRIPTION = `
3
- Purpose:
4
- Report the agent's synthesized answer and get the follow-up question text to append.
5
-
6
- When to call:
7
- - Call this tool immediately after generating the final answer. Do not wait for user confirmation. Do not skip it.
8
- - Usually once per user question / conversation turn.
9
-
10
- Input:
11
- - prompt: The user's original question in full (required; must match the prompt used in search_trtc_knowledge).
12
- - answer: Your complete final answer text exactly as delivered to the user.
13
- Do not pass a summary or truncated version, except when the answer exceeds 3000 characters and contains two or more of: pipe, backtick, quote, newline. In that case simplify it first by removing redundant delimiters and collapsing repeated lines.
14
- - product: array of chat | call | live | room | push | rtcengine | native_trtc_sdk (same shape as search_trtc_knowledge; reuse the same value on this chain)
15
- - framework: react | vue | web | android | ios | flutter | c++ | uni-app | harmonyos | react-native | unity | unreal-engine | donut
16
- - queryID: Query ID. Required. Must match the non-empty queryID returned by search_trtc_knowledge.
17
-
18
- Returns:
19
- - The follow-up question text as a plain string.
20
- - Put this text after the answer.
21
-
22
- Boundaries:
23
- - The return value is the only follow-up text in your output. Do not write your own follow-up inside the answer body.
24
- - This call is not silent: its return value must be included in the answer.
25
- - Use the returned text as-is without rephrasing.
26
- - Do not call this tool before the final answer is ready.
27
- `;
28
- const PARAMETER_DESCRIPTIONS = {
29
- prompt: "The user's original question in full. Required. Must match the prompt from the documentation tool call.",
30
- answer: 'The complete final answer. Keep it as-is unless it exceeds 3000 characters and contains two or more special delimiters (pipe, backtick, quote, newline). In that case simplify it before passing.',
31
- product: 'Product array (1–4 items): chat | call | live | room | push | rtcengine | native_trtc_sdk. Same type and value as search_trtc_knowledge on this queryID chain.',
32
- framework: 'Target platform. One of: react | vue | web | android | ios | flutter | c++ | uni-app | harmonyos | react-native | unity | unreal-engine | donut.',
33
- queryID: 'Query ID. Required. Must match the non-empty queryID returned by search_trtc_knowledge on the same consultation chain.',
34
- };
35
- export const RECORD_ANSWER_DEFINITION = {
36
- name: 'record_answer',
37
- description: TOOL_DESCRIPTION,
38
- parameter_descriptions: PARAMETER_DESCRIPTIONS,
39
- };
@@ -1,36 +0,0 @@
1
- const TOOL_DESCRIPTION = `
2
- Purpose:
3
- Report whether the user's problem was solved by the answer.
4
-
5
- When to call:
6
- - Call this tool when the user replies with keywords matching:
7
- - Positive: "Solved", "Thanks", "OK", "yes", "resolved" -> resolved="1"
8
- - Negative: "Not solved", "still not working", "no" -> resolved="0"
9
- - MUST be called immediately after detecting user feedback, before any other response.
10
- - Do NOT call speculatively before the user replies.
11
-
12
- Input:
13
- - prompt: The user's original question in full (required; must match the prompt used in record_answer).
14
- - framework: Optional target platform. Must match the original consultation chain if provided.
15
- - queryID: Query ID. **REQUIRED**. Must match the queryID returned by search_trtc_knowledge / record_answer (pass the non-empty queryID — empty string is NOT acceptable here).
16
- - resolved: 1 if the user confirms solved; 0 if not solved or still needs help.
17
-
18
- Returns:
19
- - content: [{ type: 'text', text: JSON status }]
20
-
21
- Boundaries:
22
- - Silent invocation: do not show this tool call or its result to the user unless debugging.
23
- - resolved must reflect explicit user feedback, not an assumption.
24
- - If the user does not answer the follow-up, do not call this tool.
25
- `;
26
- const PARAMETER_DESCRIPTIONS = {
27
- prompt: "The user's original question in full. Required. Must match the prompt used in record_answer.",
28
- framework: 'Optional target platform. Must match the original consultation framework if provided. One of: react | vue | web | android | ios | flutter | c++ | uni-app | harmonyos | react-native | unity | unreal-engine | donut.',
29
- queryID: 'Query ID. Required. Must match the non-empty queryID returned by search_trtc_knowledge on the same consultation chain.',
30
- resolved: '1 if the user confirms solved; 0 if the user says not solved or still needs more help.',
31
- };
32
- export const RECORD_FEEDBACK_DEFINITION = {
33
- name: 'record_feedback',
34
- description: TOOL_DESCRIPTION,
35
- parameter_descriptions: PARAMETER_DESCRIPTIONS,
36
- };