@zzp123/mcp-zentao 1.7.2 → 1.7.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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.7.3] - 2025-11-06
9
+
10
+ ### Fixed
11
+ - **updateStory 工具参数格式优化**
12
+ - 修复 `update` 参数只能接受对象格式的问题
13
+ - 现在同时支持对象格式和 JSON 字符串格式
14
+ - 自动解析 JSON 字符串并提供友好的错误提示
15
+
16
+ ### Changed
17
+ - `update` 参数使用 `z.union()` 同时接受对象和字符串格式
18
+ - 添加 JSON 字符串解析逻辑,提升工具兼容性
19
+
8
20
  ## [1.7.2] - 2025-11-06
9
21
 
10
22
  ### Added
package/dist/index.js CHANGED
@@ -463,52 +463,68 @@ server.tool("getProjects", {
463
463
  // Add updateStory tool
464
464
  server.tool("updateStory", {
465
465
  storyId: z.number(),
466
- update: z.object({
467
- // 基本信息
468
- title: z.string().optional(),
469
- product: z.number().optional(),
470
- parent: z.number().optional(),
471
- module: z.number().optional(),
472
- branch: z.number().optional(),
473
- plan: z.union([z.number(), z.array(z.number())]).optional(),
474
- type: z.string().optional(),
475
- // 来源信息
476
- source: z.string().optional(),
477
- sourceNote: z.string().optional(),
478
- // 分类与优先级
479
- category: z.string().optional(),
480
- pri: z.number().optional(),
481
- estimate: z.number().optional(),
482
- // 状态与阶段
483
- stage: z.string().optional(),
484
- status: z.string().optional(),
485
- // 关键词与标识
486
- keywords: z.string().optional(),
487
- color: z.string().optional(),
488
- grade: z.number().optional(),
489
- // 人员相关
490
- mailto: z.array(z.string()).optional(),
491
- reviewer: z.array(z.string()).optional(),
492
- assignedTo: z.string().optional(),
493
- closedBy: z.string().optional(),
494
- feedbackBy: z.string().optional(),
495
- // 关闭相关
496
- closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
497
- duplicateStory: z.number().optional(),
498
- // 评审相关
499
- needNotReview: z.boolean().optional(),
500
- // 通知相关
501
- notifyEmail: z.string().optional(),
502
- // 描述内容
503
- spec: z.string().optional(),
504
- verify: z.string().optional(),
505
- // 备注
506
- comment: z.string().optional()
507
- }).describe("需求更新字段 - 根据API文档支持29个可编辑字段")
466
+ update: z.union([
467
+ z.object({
468
+ // 基本信息
469
+ title: z.string().optional(),
470
+ product: z.number().optional(),
471
+ parent: z.number().optional(),
472
+ module: z.number().optional(),
473
+ branch: z.number().optional(),
474
+ plan: z.union([z.number(), z.array(z.number())]).optional(),
475
+ type: z.string().optional(),
476
+ // 来源信息
477
+ source: z.string().optional(),
478
+ sourceNote: z.string().optional(),
479
+ // 分类与优先级
480
+ category: z.string().optional(),
481
+ pri: z.number().optional(),
482
+ estimate: z.number().optional(),
483
+ // 状态与阶段
484
+ stage: z.string().optional(),
485
+ status: z.string().optional(),
486
+ // 关键词与标识
487
+ keywords: z.string().optional(),
488
+ color: z.string().optional(),
489
+ grade: z.number().optional(),
490
+ // 人员相关
491
+ mailto: z.array(z.string()).optional(),
492
+ reviewer: z.array(z.string()).optional(),
493
+ assignedTo: z.string().optional(),
494
+ closedBy: z.string().optional(),
495
+ feedbackBy: z.string().optional(),
496
+ // 关闭相关
497
+ closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
498
+ duplicateStory: z.number().optional(),
499
+ // 评审相关
500
+ needNotReview: z.boolean().optional(),
501
+ // 通知相关
502
+ notifyEmail: z.string().optional(),
503
+ // 描述内容
504
+ spec: z.string().optional(),
505
+ verify: z.string().optional(),
506
+ // 备注
507
+ comment: z.string().optional()
508
+ }),
509
+ z.string()
510
+ ]).describe("需求更新字段 - 支持对象或JSON字符串格式")
508
511
  }, async ({ storyId, update }) => {
509
512
  if (!zentaoApi)
510
513
  throw new Error("Please initialize Zentao API first");
511
- const story = await zentaoApi.updateStory(storyId, update);
514
+ // 如果 update 是字符串,尝试解析为对象
515
+ let updateData;
516
+ if (typeof update === 'string') {
517
+ try {
518
+ updateData = JSON.parse(update);
519
+ }
520
+ catch (error) {
521
+ throw new Error(`Invalid JSON string: ${error instanceof Error ? error.message : 'Unknown error'}`);
522
+ }
523
+ }
524
+ else {
525
+ updateData = update;
526
+ }
527
+ const story = await zentaoApi.updateStory(storyId, updateData);
512
528
  return {
513
529
  content: [{ type: "text", text: JSON.stringify(story, null, 2) }]
514
530
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",