dingtalk-mcp 1.0.8 → 1.0.9

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.
@@ -14,7 +14,6 @@ tools:
14
14
  - name: robotCode
15
15
  description: 机器人Code
16
16
  type: string
17
- required: true
18
17
  position: body
19
18
  system: ROBOT_CODE
20
19
  - name: remindType
@@ -45,12 +44,11 @@ tools:
45
44
  responseTemplate: {}
46
45
 
47
46
  - name: recallDINGMessage
48
- description: 机器人发送DING消息
47
+ description: 撤回机器人发送DING的消息
49
48
  args:
50
49
  - name: robotCode
51
50
  description: 机器人Code
52
51
  type: string
53
- required: true
54
52
  position: body
55
53
  system: ROBOT_CODE
56
54
  - name: openDingId
@@ -67,13 +65,13 @@ tools:
67
65
  security:
68
66
  id: DingTalkAuth
69
67
  responseTemplate: { }
68
+
70
69
  - name: sendGroupMessageByRobot
71
70
  description: 机器人发送群消息
72
71
  args:
73
72
  - name: robotCode
74
73
  description: 机器人Code
75
74
  type: string
76
- required: true
77
75
  position: body
78
76
  system: ROBOT_CODE
79
77
  - name: openConversationId
@@ -90,6 +88,9 @@ tools:
90
88
  type: string
91
89
  description: 消息模板key,默认为"sampleMarkdown"。
92
90
  position: body
91
+ default: sampleMarkdown
92
+ # 不需要模型处理
93
+ not_need_model_transform: true
93
94
  - name: msgParam
94
95
  type: string
95
96
  description: 消息内容,为markdown格式。
@@ -112,7 +113,6 @@ tools:
112
113
  - name: robotCode
113
114
  description: 机器人Code
114
115
  type: string
115
- required: true
116
116
  position: body
117
117
  system: ROBOT_CODE
118
118
  - name: openConversationId
@@ -144,7 +144,6 @@ tools:
144
144
  - name: robotCode
145
145
  description: 机器人Code
146
146
  type: string
147
- required: true
148
147
  position: body
149
148
  system: ROBOT_CODE
150
149
  - name: userIds
@@ -158,6 +157,9 @@ tools:
158
157
  type: string
159
158
  description: 消息模板key,默认为"sampleMarkdown"。
160
159
  position: body
160
+ default: sampleMarkdown
161
+ # 不需要模型处理
162
+ not_need_model_transform: true
161
163
  - name: msgParam
162
164
  type: string
163
165
  description: 消息内容,为markdown格式。
@@ -173,13 +175,13 @@ tools:
173
175
  security:
174
176
  id: DingTalkAuth
175
177
  responseTemplate: { }
178
+
176
179
  - name: batchRecallUserMessageByRobot
177
180
  description: 批量撤回机器人给人发送的消息
178
181
  args:
179
182
  - name: robotCode
180
183
  description: 机器人Code
181
184
  type: string
182
- required: true
183
185
  position: body
184
186
  system: ROBOT_CODE
185
187
  - name: processQueryKeys
@@ -202,6 +204,13 @@ tools:
202
204
  - name: sendMessageByCustomRobot
203
205
  description: 群自定义机器人发送群消息
204
206
  args:
207
+ - name: msgtype
208
+ description: 消息类型,默认为markdown
209
+ type: string
210
+ position: body
211
+ default: markdown
212
+ # 不需要模型处理
213
+ not_need_model_transform: true
205
214
  - name: markdown.title
206
215
  type: string
207
216
  description: 消息标题。
@@ -35,7 +35,7 @@ export class DingTalkMCPServer {
35
35
  loadConfig() {
36
36
  try {
37
37
  //激活的profile
38
- const profiles = process.env.ACTIOVE_PROFILES;
38
+ const profiles = process.env.ACTIVE_PROFILES;
39
39
  let profiles_list = [];
40
40
  if (profiles){
41
41
  profiles_list = profiles.split(',');
@@ -52,7 +52,7 @@ export class DingTalkMCPServer {
52
52
  if (!config) {
53
53
  throw new Error('Config is empty');
54
54
  }
55
- if (profiles_list.includes(config.server.name) || (profiles_list.length == 0 && config.server.default_active)) {
55
+ if (profiles_list.includes("ALL") || profiles_list.includes(config.server.name) || (profiles_list.length == 0 && config.server.default_active)) {
56
56
 
57
57
  (config.tools || []).forEach(tool => {
58
58
  if (this.tools.includes(tool.name)) {
@@ -69,7 +69,7 @@ export class DingTalkMCPServer {
69
69
  );
70
70
  if (this.tools && this.tools.length > 0) {
71
71
  console.error(`Loaded ${this.tools.length} tools from config`);
72
- console.error(`Tools: ${this.tools.map(t => t.name).join(', ')}`);
72
+ console.error(`Tools:\r\n${this.tools.map(t => t.name + ', ' + t.description).join('\r\n')}`);
73
73
  }else{
74
74
  throw new Error('No tools found in config, tools is empty');
75
75
  }
@@ -218,6 +218,19 @@ export class DingTalkMCPServer {
218
218
  }
219
219
  setupHandlers() {
220
220
  // 列出可用工具
221
+ if (this.debug){
222
+ const tools = this.tools.map(tool => ({
223
+ name: tool.name,
224
+ description: tool.description,
225
+ inputSchema: {
226
+ type: 'object',
227
+ properties: this.generateSchema(tool.args || []),
228
+ required: (tool.args || []).filter(arg => arg.required).map(arg => arg.name)
229
+ }
230
+ }));
231
+ console.error(JSON.stringify(tools, null, 2));
232
+
233
+ }
221
234
  this.server.setRequestHandler(ListToolsRequestSchema, async () => {
222
235
  const tools = this.tools.map(tool => ({
223
236
  name: tool.name,
@@ -228,9 +241,7 @@ export class DingTalkMCPServer {
228
241
  required: (tool.args || []).filter(arg => arg.required).map(arg => arg.name)
229
242
  }
230
243
  }));
231
- if(this.debug){
232
- console.error(JSON.stringify(tools, null, 2));
233
- }
244
+
234
245
  return { tools };
235
246
  });
236
247
  // 执行工具调用
@@ -251,6 +262,10 @@ export class DingTalkMCPServer {
251
262
  // 如果 system 属性有值,则跳过本次循环,不给大模型构造这个参数
252
263
  return;
253
264
  }
265
+ if (arg.not_need_model_transform) {
266
+ // 如果 need_model_transform 属性有值,则跳过本次循环,不给大模型构造这个参数
267
+ return;
268
+ }
254
269
  schema[arg.name] = {
255
270
  type: arg.type,
256
271
  description: arg.description
@@ -396,12 +411,17 @@ export class DingTalkMCPServer {
396
411
  body[arg.name] = process.env[arg.system];
397
412
  return;
398
413
  }
414
+ // 不需要模型处理,直接取默认值赋值
415
+ if (args.not_need_model_transform){
416
+ body[arg.name] = arg.default
417
+ return;
418
+ }
399
419
 
400
420
  // 如果模型没有对应提参,则不赋值给API对应的入参
401
421
  if (!args[arg.name]) {
402
422
  return;
403
423
  }
404
- //Object类型参数,递归处理
424
+ //打平Object类型参数,递归处理
405
425
  let objParmas = arg.name.split('.');
406
426
  if (objParmas && objParmas.length > 1) {
407
427
  if (objParmas.length == 2){
package/dist/cli.js CHANGED
@@ -2,8 +2,9 @@
2
2
  import { DingTalkMCPServer } from './DingTalkMCPServer.js';
3
3
  async function main() {
4
4
  try {
5
- // process.env.debug = true;
6
- // process.env.ACTIOVE_PROFILES = "dingtalk-contacts,dingtalk-robot-send-message";
5
+ // process.env.DEBUG = true;
6
+ // process.env.ACTIVE_PROFILES = "ALL";
7
+ // process.env.ROBOT_CODE = "234234"
7
8
  const server = new DingTalkMCPServer();
8
9
  await server.run();
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dingtalk-mcp",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "DingTalk MCP Server - A TypeScript-based MCP server for DingTalk integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",