@mcpcn/mcp-notification 1.1.1 → 1.1.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/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,9 +12,11 @@ function resolveChatSessionId(request) {
|
|
|
12
12
|
}
|
|
13
13
|
return undefined;
|
|
14
14
|
};
|
|
15
|
-
return (pick(request?.
|
|
15
|
+
return (pick(request?.meta, ['chatSessionId', 'chatSessionID']) ??
|
|
16
16
|
pick(request?.params?.meta, ['chatSessionId', 'chatSessionID']) ??
|
|
17
|
-
pick(request?._meta, ['chatSessionId', 'chatSessionID'])
|
|
17
|
+
pick(request?.params?._meta, ['chatSessionId', 'chatSessionID']) ??
|
|
18
|
+
pick(request?._meta, ['chatSessionId', 'chatSessionID']) ??
|
|
19
|
+
pick(request?.params?.arguments, ['chatSessionId', 'chatSessionID']));
|
|
18
20
|
}
|
|
19
21
|
async function postJson(path, body, chatSessionId) {
|
|
20
22
|
const headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
@@ -134,11 +136,13 @@ class ReminderServer {
|
|
|
134
136
|
}));
|
|
135
137
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
136
138
|
try {
|
|
139
|
+
console.error('[调试] request.params keys = ' + JSON.stringify(Object.keys(request.params || {})));
|
|
137
140
|
if (!request.params.arguments || typeof request.params.arguments !== 'object') {
|
|
138
141
|
throw new McpError(ErrorCode.InvalidParams, '无效的参数');
|
|
139
142
|
}
|
|
140
143
|
const name = request.params.name;
|
|
141
144
|
const args = request.params.arguments;
|
|
145
|
+
console.error(`收到工具调用请求: ${name}, 输入: ${JSON.stringify(args)}`);
|
|
142
146
|
const chatSessionId = resolveChatSessionId(request);
|
|
143
147
|
if (!chatSessionId) {
|
|
144
148
|
console.error('通知工具未在请求中检测到 chatSessionId(meta.chatSessionId)');
|