@zzp123/mcp-zentao 1.18.1 → 1.18.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 +14 -0
- package/dist/api/zentaoApi.d.ts +2 -3
- package/dist/api/zentaoApi.js +4 -5
- package/dist/index-dev.js +3 -4
- package/dist/index-pm.js +47 -66
- package/dist/index-qa.js +3 -4
- package/dist/index.js +65 -101
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ 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.18.3] - 2025-01-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **修复MCP协议兼容性问题** 🔧
|
|
12
|
+
- 修复 `changeStory` 和 `changeRequirement` 工具的参数类型错误
|
|
13
|
+
- 移除 `z.union([z.object({...}), z.string()])` 改为纯对象类型
|
|
14
|
+
- 解决 "Expected object, received string" 错误
|
|
15
|
+
- 同时修复完整版和产品经理版本
|
|
16
|
+
|
|
17
|
+
### Technical
|
|
18
|
+
- 更新 `src/index.ts` 中的 `changeStory` 和 `changeRequirement` 工具定义
|
|
19
|
+
- 更新 `src/index-pm.ts` 中的 `changeStory` 工具定义
|
|
20
|
+
- 符合MCP协议规范,所有参数必须是对象类型
|
|
21
|
+
|
|
8
22
|
## [1.17.6] - 2025-11-10
|
|
9
23
|
|
|
10
24
|
### Changed
|
package/dist/api/zentaoApi.d.ts
CHANGED
|
@@ -33,17 +33,16 @@ export declare class ZentaoAPI {
|
|
|
33
33
|
*/
|
|
34
34
|
private filterBugFields;
|
|
35
35
|
/**
|
|
36
|
-
* 获取我的 Bug 列表(固定查询指派给我的 Bug
|
|
36
|
+
* 获取我的 Bug 列表(固定查询指派给我的 Bug,固定每页20条)
|
|
37
37
|
*
|
|
38
38
|
* @param productId 产品ID(可选,默认使用第二个产品)
|
|
39
39
|
* @param page 页码(从1开始,默认1)
|
|
40
|
-
* @param limit 每页数量(默认20,最大100)
|
|
41
40
|
* @param branch 分支筛选('all'所有分支/'0'主干/分支ID,默认'all')
|
|
42
41
|
* @param order 排序字段(如:'id_desc'、'pri_desc'等,默认'id_desc')
|
|
43
42
|
* @param fields 返回字段级别('basic'基本/'default'默认/'full'完整,默认'basic')
|
|
44
43
|
* @returns Promise<Bug列表及分页信息>
|
|
45
44
|
*/
|
|
46
|
-
getMyBugs(productId?: number, page?: number,
|
|
45
|
+
getMyBugs(productId?: number, page?: number, branch?: string, order?: string, fields?: 'basic' | 'default' | 'full'): Promise<{
|
|
47
46
|
page: number;
|
|
48
47
|
total: number;
|
|
49
48
|
limit: number;
|
package/dist/api/zentaoApi.js
CHANGED
|
@@ -235,17 +235,16 @@ export class ZentaoAPI {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
|
-
* 获取我的 Bug 列表(固定查询指派给我的 Bug
|
|
238
|
+
* 获取我的 Bug 列表(固定查询指派给我的 Bug,固定每页20条)
|
|
239
239
|
*
|
|
240
240
|
* @param productId 产品ID(可选,默认使用第二个产品)
|
|
241
241
|
* @param page 页码(从1开始,默认1)
|
|
242
|
-
* @param limit 每页数量(默认20,最大100)
|
|
243
242
|
* @param branch 分支筛选('all'所有分支/'0'主干/分支ID,默认'all')
|
|
244
243
|
* @param order 排序字段(如:'id_desc'、'pri_desc'等,默认'id_desc')
|
|
245
244
|
* @param fields 返回字段级别('basic'基本/'default'默认/'full'完整,默认'basic')
|
|
246
245
|
* @returns Promise<Bug列表及分页信息>
|
|
247
246
|
*/
|
|
248
|
-
async getMyBugs(productId, page,
|
|
247
|
+
async getMyBugs(productId, page, branch, order, fields) {
|
|
249
248
|
if (!productId) {
|
|
250
249
|
// 如果没有提供产品ID,获取第二个可用的产品(索引为1)
|
|
251
250
|
const products = await this.getProducts();
|
|
@@ -256,8 +255,8 @@ export class ZentaoAPI {
|
|
|
256
255
|
productId = products.length > 1 ? products[1].id : products[0].id;
|
|
257
256
|
console.log(`使用产品ID: ${productId} (${products.length > 1 ? '第二个' : '第一个'})`);
|
|
258
257
|
}
|
|
259
|
-
//
|
|
260
|
-
const finalLimit =
|
|
258
|
+
// 固定每页20条
|
|
259
|
+
const finalLimit = 20;
|
|
261
260
|
const finalPage = page || 1;
|
|
262
261
|
const finalBranch = branch || 'all';
|
|
263
262
|
const finalOrder = order || 'id_desc';
|
package/dist/index-dev.js
CHANGED
|
@@ -75,17 +75,16 @@ server.tool("getTaskDetail", {
|
|
|
75
75
|
content: [{ type: "text", text: JSON.stringify(task, null, 2) }]
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'
|
|
78
|
+
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'),固定每页20条", {
|
|
79
79
|
productId: z.number().optional().describe("产品ID,默认使用第二个产品"),
|
|
80
80
|
page: z.number().optional().describe("页码,从1开始,默认为1"),
|
|
81
|
-
limit: z.number().optional().describe("每页数量,默认20,最大100"),
|
|
82
81
|
branch: z.string().optional().describe("分支筛选:'all'(所有分支,默认)、'0'(主干分支)、分支ID"),
|
|
83
82
|
order: z.string().optional().describe("排序方式,如 id_desc(ID降序), pri_desc(优先级降序), openedDate_desc(创建时间降序)等,默认id_desc"),
|
|
84
83
|
fields: z.enum(['basic', 'default', 'full']).optional().describe("返回字段级别:'basic'(基本字段,默认)、'default'(默认字段)、'full'(完整字段),默认'basic'")
|
|
85
|
-
}, async ({ productId, page,
|
|
84
|
+
}, async ({ productId, page, branch, order, fields }) => {
|
|
86
85
|
if (!zentaoApi)
|
|
87
86
|
throw new Error("Please initialize Zentao API first");
|
|
88
|
-
const result = await zentaoApi.getMyBugs(productId, page,
|
|
87
|
+
const result = await zentaoApi.getMyBugs(productId, page, branch, order, fields);
|
|
89
88
|
// 返回分页信息和数据
|
|
90
89
|
const summary = {
|
|
91
90
|
summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
|
package/dist/index-pm.js
CHANGED
|
@@ -85,17 +85,16 @@ server.tool("getProducts", "获取产品列表 - 只返回核心字段(id, 名
|
|
|
85
85
|
content: [{ type: "text", text: JSON.stringify(products, null, 2) }]
|
|
86
86
|
};
|
|
87
87
|
});
|
|
88
|
-
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'
|
|
88
|
+
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'),固定每页20条", {
|
|
89
89
|
productId: z.number().optional().describe("产品ID,默认使用第二个产品"),
|
|
90
90
|
page: z.number().optional().describe("页码,从1开始,默认为1"),
|
|
91
|
-
limit: z.number().optional().describe("每页数量,默认20,最大100"),
|
|
92
91
|
branch: z.string().optional().describe("分支筛选:'all'(所有分支,默认)、'0'(主干分支)、分支ID"),
|
|
93
92
|
order: z.string().optional().describe("排序方式,如 id_desc(ID降序), pri_desc(优先级降序), openedDate_desc(创建时间降序)等,默认id_desc"),
|
|
94
93
|
fields: z.enum(['basic', 'default', 'full']).optional().describe("返回字段级别:'basic'(基本字段,默认)、'default'(默认字段)、'full'(完整字段),默认'basic'")
|
|
95
|
-
}, async ({ productId, page,
|
|
94
|
+
}, async ({ productId, page, branch, order, fields }) => {
|
|
96
95
|
if (!zentaoApi)
|
|
97
96
|
throw new Error("Please initialize Zentao API first");
|
|
98
|
-
const result = await zentaoApi.getMyBugs(productId, page,
|
|
97
|
+
const result = await zentaoApi.getMyBugs(productId, page, branch, order, fields);
|
|
99
98
|
// 返回分页信息和数据
|
|
100
99
|
const summary = {
|
|
101
100
|
summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
|
|
@@ -376,76 +375,58 @@ server.tool("createPlan", {
|
|
|
376
375
|
content: [{ type: "text", text: JSON.stringify(plan, null, 2) }]
|
|
377
376
|
};
|
|
378
377
|
});
|
|
379
|
-
server.tool("changeStory", "需求变更 - 支持软件需求(story)和用户需求(requirement)
|
|
378
|
+
server.tool("changeStory", "需求变更 - 支持软件需求(story)和用户需求(requirement),自动识别类型", {
|
|
380
379
|
storyId: z.number().describe("需求ID(可以是story或requirement类型)"),
|
|
381
|
-
update: z.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}),
|
|
424
|
-
z.string()
|
|
425
|
-
]).describe(`更新需求(使用 PUT 接口)
|
|
380
|
+
update: z.object({
|
|
381
|
+
// 基本信息
|
|
382
|
+
title: z.string().optional(),
|
|
383
|
+
product: z.number().optional(),
|
|
384
|
+
parent: z.number().optional(),
|
|
385
|
+
module: z.number().optional(),
|
|
386
|
+
branch: z.number().optional(),
|
|
387
|
+
plan: z.union([z.number(), z.array(z.number())]).optional(),
|
|
388
|
+
type: z.string().optional(),
|
|
389
|
+
// 来源信息
|
|
390
|
+
source: z.string().optional(),
|
|
391
|
+
sourceNote: z.string().optional(),
|
|
392
|
+
// 分类与优先级
|
|
393
|
+
category: z.string().optional(),
|
|
394
|
+
pri: z.number().optional(),
|
|
395
|
+
estimate: z.number().optional(),
|
|
396
|
+
// 状态与阶段
|
|
397
|
+
stage: z.string().optional(),
|
|
398
|
+
status: z.string().optional(),
|
|
399
|
+
// 关键词与标识
|
|
400
|
+
keywords: z.string().optional(),
|
|
401
|
+
color: z.string().optional(),
|
|
402
|
+
grade: z.number().optional(),
|
|
403
|
+
// 人员相关
|
|
404
|
+
mailto: z.array(z.string()).optional(),
|
|
405
|
+
reviewer: z.array(z.string()).optional().describe("评审人员列表(通常为必填,除非设置needNotReview=true跳过评审)"),
|
|
406
|
+
assignedTo: z.string().optional(),
|
|
407
|
+
closedBy: z.string().optional(),
|
|
408
|
+
feedbackBy: z.string().optional(),
|
|
409
|
+
// 关闭相关
|
|
410
|
+
closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
|
|
411
|
+
duplicateStory: z.number().optional(),
|
|
412
|
+
// 评审相关
|
|
413
|
+
needNotReview: z.boolean().optional().describe("是否跳过评审,如果不提供reviewer则应设置为true"),
|
|
414
|
+
// 通知相关
|
|
415
|
+
notifyEmail: z.string().optional(),
|
|
416
|
+
// 描述内容
|
|
417
|
+
spec: z.string().optional(),
|
|
418
|
+
verify: z.string().optional(),
|
|
419
|
+
// 备注
|
|
420
|
+
comment: z.string().optional()
|
|
421
|
+
}).describe(`更新需求(使用 PUT 接口)
|
|
426
422
|
|
|
427
423
|
此工具使用标准的"修改需求其他字段"接口(PUT /stories/:id),支持修改29个字段。
|
|
428
424
|
自动处理评审人问题,无需手动设置 needNotReview。
|
|
429
|
-
|
|
430
|
-
支持对象或JSON字符串格式。
|
|
431
425
|
`.trim())
|
|
432
426
|
}, async ({ storyId, update }) => {
|
|
433
427
|
if (!zentaoApi)
|
|
434
428
|
throw new Error("Please initialize Zentao API first");
|
|
435
|
-
|
|
436
|
-
let updateData;
|
|
437
|
-
if (typeof update === 'string') {
|
|
438
|
-
try {
|
|
439
|
-
updateData = JSON.parse(update);
|
|
440
|
-
}
|
|
441
|
-
catch (error) {
|
|
442
|
-
throw new Error(`Invalid JSON string: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
updateData = update;
|
|
447
|
-
}
|
|
448
|
-
const story = await zentaoApi.changeStory(storyId, updateData);
|
|
429
|
+
const story = await zentaoApi.changeStory(storyId, update);
|
|
449
430
|
return {
|
|
450
431
|
content: [{ type: "text", text: JSON.stringify(story, null, 2) }]
|
|
451
432
|
};
|
package/dist/index-qa.js
CHANGED
|
@@ -75,17 +75,16 @@ server.tool("getTaskDetail", {
|
|
|
75
75
|
content: [{ type: "text", text: JSON.stringify(task, null, 2) }]
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'
|
|
78
|
+
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'),固定每页20条", {
|
|
79
79
|
productId: z.number().optional().describe("产品ID,默认使用第二个产品"),
|
|
80
80
|
page: z.number().optional().describe("页码,从1开始,默认为1"),
|
|
81
|
-
limit: z.number().optional().describe("每页数量,默认20,最大100"),
|
|
82
81
|
branch: z.string().optional().describe("分支筛选:'all'(所有分支,默认)、'0'(主干分支)、分支ID"),
|
|
83
82
|
order: z.string().optional().describe("排序方式,如 id_desc(ID降序), pri_desc(优先级降序), openedDate_desc(创建时间降序)等,默认id_desc"),
|
|
84
83
|
fields: z.enum(['basic', 'default', 'full']).optional().describe("返回字段级别:'basic'(基本字段,默认)、'default'(默认字段)、'full'(完整字段),默认'basic'")
|
|
85
|
-
}, async ({ productId, page,
|
|
84
|
+
}, async ({ productId, page, branch, order, fields }) => {
|
|
86
85
|
if (!zentaoApi)
|
|
87
86
|
throw new Error("Please initialize Zentao API first");
|
|
88
|
-
const result = await zentaoApi.getMyBugs(productId, page,
|
|
87
|
+
const result = await zentaoApi.getMyBugs(productId, page, branch, order, fields);
|
|
89
88
|
// 返回分页信息和数据
|
|
90
89
|
const summary = {
|
|
91
90
|
summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
|
package/dist/index.js
CHANGED
|
@@ -89,17 +89,16 @@ server.tool("getProducts", "获取产品列表 - 只返回核心字段(id, 名
|
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
91
|
// Add getMyBugs tool
|
|
92
|
-
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'
|
|
92
|
+
server.tool("getMyBugs", "获取我的Bug列表 - 固定查询指派给我的Bug(status='assigntome'),固定每页20条", {
|
|
93
93
|
productId: z.number().optional().describe("产品ID,默认使用第二个产品"),
|
|
94
94
|
page: z.number().optional().describe("页码,从1开始,默认为1"),
|
|
95
|
-
limit: z.number().optional().describe("每页数量,默认20,最大100"),
|
|
96
95
|
branch: z.string().optional().describe("分支筛选:'all'(所有分支,默认)、'0'(主干分支)、分支ID"),
|
|
97
96
|
order: z.string().optional().describe("排序方式,如 id_desc(ID降序), pri_desc(优先级降序), openedDate_desc(创建时间降序)等,默认id_desc"),
|
|
98
97
|
fields: z.enum(['basic', 'default', 'full']).optional().describe("返回字段级别:'basic'(基本字段,默认)、'default'(默认字段)、'full'(完整字段),默认'basic'")
|
|
99
|
-
}, async ({ productId, page,
|
|
98
|
+
}, async ({ productId, page, branch, order, fields }) => {
|
|
100
99
|
if (!zentaoApi)
|
|
101
100
|
throw new Error("Please initialize Zentao API first");
|
|
102
|
-
const result = await zentaoApi.getMyBugs(productId, page,
|
|
101
|
+
const result = await zentaoApi.getMyBugs(productId, page, branch, order, fields);
|
|
103
102
|
// 返回分页信息和数据
|
|
104
103
|
const summary = {
|
|
105
104
|
summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
|
|
@@ -565,76 +564,58 @@ server.tool("getProjects", {
|
|
|
565
564
|
};
|
|
566
565
|
});
|
|
567
566
|
// Add changeStory tool
|
|
568
|
-
server.tool("changeStory", "需求变更 - 支持软件需求(story)和用户需求(requirement)
|
|
567
|
+
server.tool("changeStory", "需求变更 - 支持软件需求(story)和用户需求(requirement),自动识别类型", {
|
|
569
568
|
storyId: z.number().describe("需求ID(可以是story或requirement类型)"),
|
|
570
|
-
update: z.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}),
|
|
613
|
-
z.string()
|
|
614
|
-
]).describe(`更新需求(使用 PUT 接口)
|
|
569
|
+
update: z.object({
|
|
570
|
+
// 基本信息
|
|
571
|
+
title: z.string().optional(),
|
|
572
|
+
product: z.number().optional(),
|
|
573
|
+
parent: z.number().optional(),
|
|
574
|
+
module: z.number().optional(),
|
|
575
|
+
branch: z.number().optional(),
|
|
576
|
+
plan: z.union([z.number(), z.array(z.number())]).optional(),
|
|
577
|
+
type: z.string().optional(),
|
|
578
|
+
// 来源信息
|
|
579
|
+
source: z.string().optional(),
|
|
580
|
+
sourceNote: z.string().optional(),
|
|
581
|
+
// 分类与优先级
|
|
582
|
+
category: z.string().optional(),
|
|
583
|
+
pri: z.number().optional(),
|
|
584
|
+
estimate: z.number().optional(),
|
|
585
|
+
// 状态与阶段
|
|
586
|
+
stage: z.string().optional(),
|
|
587
|
+
status: z.string().optional(),
|
|
588
|
+
// 关键词与标识
|
|
589
|
+
keywords: z.string().optional(),
|
|
590
|
+
color: z.string().optional(),
|
|
591
|
+
grade: z.number().optional(),
|
|
592
|
+
// 人员相关
|
|
593
|
+
mailto: z.array(z.string()).optional(),
|
|
594
|
+
reviewer: z.array(z.string()).optional().describe("评审人员列表(通常为必填,除非设置needNotReview=true跳过评审)"),
|
|
595
|
+
assignedTo: z.string().optional(),
|
|
596
|
+
closedBy: z.string().optional(),
|
|
597
|
+
feedbackBy: z.string().optional(),
|
|
598
|
+
// 关闭相关
|
|
599
|
+
closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
|
|
600
|
+
duplicateStory: z.number().optional(),
|
|
601
|
+
// 评审相关
|
|
602
|
+
needNotReview: z.boolean().optional().describe("是否跳过评审,如果不提供reviewer则应设置为true"),
|
|
603
|
+
// 通知相关
|
|
604
|
+
notifyEmail: z.string().optional(),
|
|
605
|
+
// 描述内容
|
|
606
|
+
spec: z.string().optional(),
|
|
607
|
+
verify: z.string().optional(),
|
|
608
|
+
// 备注
|
|
609
|
+
comment: z.string().optional()
|
|
610
|
+
}).describe(`更新需求(使用 PUT 接口)
|
|
615
611
|
|
|
616
612
|
此工具使用标准的"修改需求其他字段"接口(PUT /stories/:id),支持修改29个字段。
|
|
617
613
|
自动处理评审人问题,无需手动设置 needNotReview。
|
|
618
|
-
|
|
619
|
-
支持对象或JSON字符串格式。
|
|
620
614
|
`.trim())
|
|
621
615
|
}, async ({ storyId, update }) => {
|
|
622
616
|
if (!zentaoApi)
|
|
623
617
|
throw new Error("Please initialize Zentao API first");
|
|
624
|
-
|
|
625
|
-
let updateData;
|
|
626
|
-
if (typeof update === 'string') {
|
|
627
|
-
try {
|
|
628
|
-
updateData = JSON.parse(update);
|
|
629
|
-
}
|
|
630
|
-
catch (error) {
|
|
631
|
-
throw new Error(`Invalid JSON string: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
updateData = update;
|
|
636
|
-
}
|
|
637
|
-
const story = await zentaoApi.changeStory(storyId, updateData);
|
|
618
|
+
const story = await zentaoApi.changeStory(storyId, update);
|
|
638
619
|
return {
|
|
639
620
|
content: [{ type: "text", text: JSON.stringify(story, null, 2) }]
|
|
640
621
|
};
|
|
@@ -879,49 +860,32 @@ server.tool("getRequirementDetail", "获取用户需求详情 - 用户需求的
|
|
|
879
860
|
});
|
|
880
861
|
server.tool("changeRequirement", "用户需求变更 - 用户需求的专用接口,提供更好的语义化", {
|
|
881
862
|
requirementId: z.number().describe("用户需求ID"),
|
|
882
|
-
update: z.
|
|
883
|
-
z.
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}),
|
|
900
|
-
z.string().describe("JSON字符串格式的更新内容")
|
|
901
|
-
]).describe(`
|
|
863
|
+
update: z.object({
|
|
864
|
+
title: z.string().optional(),
|
|
865
|
+
product: z.number().optional(),
|
|
866
|
+
parent: z.number().optional(),
|
|
867
|
+
module: z.number().optional(),
|
|
868
|
+
pri: z.number().optional(),
|
|
869
|
+
category: z.string().optional(),
|
|
870
|
+
spec: z.string().optional(),
|
|
871
|
+
verify: z.string().optional(),
|
|
872
|
+
source: z.string().optional(),
|
|
873
|
+
sourceNote: z.string().optional(),
|
|
874
|
+
estimate: z.number().optional(),
|
|
875
|
+
keywords: z.string().optional(),
|
|
876
|
+
assignedTo: z.string().optional(),
|
|
877
|
+
reviewer: z.array(z.string()).optional(),
|
|
878
|
+
comment: z.string().optional()
|
|
879
|
+
}).describe(`
|
|
902
880
|
更新用户需求(使用 PUT /stories/:id 接口)
|
|
903
881
|
|
|
904
882
|
此工具使用标准的"修改需求其他字段"接口(PUT /stories/:id),支持修改多个字段。
|
|
905
883
|
自动处理评审人问题,无需手动设置 needNotReview。
|
|
906
|
-
|
|
907
|
-
支持对象或JSON字符串格式。
|
|
908
884
|
`.trim())
|
|
909
885
|
}, async ({ requirementId, update }) => {
|
|
910
886
|
if (!zentaoApi)
|
|
911
887
|
throw new Error("Please initialize Zentao API first");
|
|
912
|
-
|
|
913
|
-
if (typeof update === 'string') {
|
|
914
|
-
try {
|
|
915
|
-
updateData = JSON.parse(update);
|
|
916
|
-
}
|
|
917
|
-
catch (e) {
|
|
918
|
-
throw new Error('Invalid JSON string for update parameter');
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
else {
|
|
922
|
-
updateData = update;
|
|
923
|
-
}
|
|
924
|
-
const requirement = await zentaoApi.changeStory(requirementId, updateData);
|
|
888
|
+
const requirement = await zentaoApi.changeStory(requirementId, update);
|
|
925
889
|
return {
|
|
926
890
|
content: [{ type: "text", text: JSON.stringify(requirement, null, 2) }]
|
|
927
891
|
};
|