zephyr-scale-mcp-server 0.4.6 → 0.4.7
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/build/tool-handlers.js +22 -7
- package/package.json +1 -1
- package/src/tool-handlers.ts +28 -7
package/build/tool-handlers.js
CHANGED
|
@@ -250,6 +250,18 @@ export class ZephyrToolHandlers {
|
|
|
250
250
|
if (!tc) {
|
|
251
251
|
throw scriptUpdateError; // no test case data to build PUT payload, surface original error
|
|
252
252
|
}
|
|
253
|
+
// Fetch the existing test script to get its ID — required for the PUT to update in place
|
|
254
|
+
let existingScriptId;
|
|
255
|
+
try {
|
|
256
|
+
const scriptRes = await this.axiosInstance.get(`${this.jiraConfig.apiEndpoints.testcase}/${test_case_key}/testscript`);
|
|
257
|
+
existingScriptId = scriptRes.data?.id;
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
// no existing script — proceed without id
|
|
261
|
+
}
|
|
262
|
+
const testScriptPayload = { type: 'bdd', text: finalText };
|
|
263
|
+
if (existingScriptId)
|
|
264
|
+
testScriptPayload.id = existingScriptId;
|
|
253
265
|
const putPayload = {
|
|
254
266
|
id: tc.id,
|
|
255
267
|
key: test_case_key,
|
|
@@ -257,7 +269,7 @@ export class ZephyrToolHandlers {
|
|
|
257
269
|
status: tc.status,
|
|
258
270
|
priority: tc.priority,
|
|
259
271
|
project: tc.project,
|
|
260
|
-
testScript:
|
|
272
|
+
testScript: testScriptPayload,
|
|
261
273
|
};
|
|
262
274
|
for (const field of ['objective', 'precondition', 'estimatedTime', 'component', 'owner', 'folder']) {
|
|
263
275
|
if (tc[field] !== undefined && tc[field] !== null)
|
|
@@ -268,12 +280,15 @@ export class ZephyrToolHandlers {
|
|
|
268
280
|
if (tc.customFields && Object.keys(tc.customFields).length > 0)
|
|
269
281
|
putPayload.customFields = tc.customFields;
|
|
270
282
|
await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testcase}/${test_case_key}`, putPayload);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
283
|
+
// Note: the Zephyr Scale Cloud API's UpdateTestCaseInput does not include a testScript field,
|
|
284
|
+
// so the testScript embedded in the PUT payload is silently ignored.
|
|
285
|
+
// The only endpoint that updates script content (POST /testscript) requires the project to be active.
|
|
286
|
+
// For test cases migrated from Data Center to Cloud, the original project key may be deactivated,
|
|
287
|
+
// blocking script updates at the API level. Contact your Zephyr Scale admin to re-enable the project.
|
|
288
|
+
throw new McpError(ErrorCode.InternalError, `Cannot update test script for ${test_case_key}: the project "${test_case_key.replace(/-T\d+$/, '')}" is deactivated in Zephyr Scale Cloud. ` +
|
|
289
|
+
`This test case was likely migrated from Data Center and retains its original project key prefix. ` +
|
|
290
|
+
`POST /testcases/{key}/testscript requires an active project. ` +
|
|
291
|
+
`Please ask your Zephyr Scale admin to re-enable the project, or recreate this test case under an active Cloud project.`);
|
|
277
292
|
}
|
|
278
293
|
// Primary path succeeded — optionally rename
|
|
279
294
|
if (typeof name === 'string' && name.trim().length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-scale-mcp-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for Zephyr Scale test case management with comprehensive STEP_BY_STEP, PLAIN_TEXT, and BDD support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|
package/src/tool-handlers.ts
CHANGED
|
@@ -273,6 +273,21 @@ export class ZephyrToolHandlers {
|
|
|
273
273
|
if (!tc) {
|
|
274
274
|
throw scriptUpdateError; // no test case data to build PUT payload, surface original error
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
// Fetch the existing test script to get its ID — required for the PUT to update in place
|
|
278
|
+
let existingScriptId: number | undefined;
|
|
279
|
+
try {
|
|
280
|
+
const scriptRes = await this.axiosInstance.get(
|
|
281
|
+
`${this.jiraConfig.apiEndpoints.testcase}/${test_case_key}/testscript`
|
|
282
|
+
);
|
|
283
|
+
existingScriptId = scriptRes.data?.id;
|
|
284
|
+
} catch {
|
|
285
|
+
// no existing script — proceed without id
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const testScriptPayload: any = { type: 'bdd', text: finalText };
|
|
289
|
+
if (existingScriptId) testScriptPayload.id = existingScriptId;
|
|
290
|
+
|
|
276
291
|
const putPayload: any = {
|
|
277
292
|
id: tc.id,
|
|
278
293
|
key: test_case_key,
|
|
@@ -280,7 +295,7 @@ export class ZephyrToolHandlers {
|
|
|
280
295
|
status: tc.status,
|
|
281
296
|
priority: tc.priority,
|
|
282
297
|
project: tc.project,
|
|
283
|
-
testScript:
|
|
298
|
+
testScript: testScriptPayload,
|
|
284
299
|
};
|
|
285
300
|
for (const field of ['objective', 'precondition', 'estimatedTime', 'component', 'owner', 'folder']) {
|
|
286
301
|
if (tc[field] !== undefined && tc[field] !== null) putPayload[field] = tc[field];
|
|
@@ -290,12 +305,18 @@ export class ZephyrToolHandlers {
|
|
|
290
305
|
|
|
291
306
|
await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testcase}/${test_case_key}`, putPayload);
|
|
292
307
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
308
|
+
// Note: the Zephyr Scale Cloud API's UpdateTestCaseInput does not include a testScript field,
|
|
309
|
+
// so the testScript embedded in the PUT payload is silently ignored.
|
|
310
|
+
// The only endpoint that updates script content (POST /testscript) requires the project to be active.
|
|
311
|
+
// For test cases migrated from Data Center to Cloud, the original project key may be deactivated,
|
|
312
|
+
// blocking script updates at the API level. Contact your Zephyr Scale admin to re-enable the project.
|
|
313
|
+
throw new McpError(
|
|
314
|
+
ErrorCode.InternalError,
|
|
315
|
+
`Cannot update test script for ${test_case_key}: the project "${test_case_key.replace(/-T\d+$/, '')}" is deactivated in Zephyr Scale Cloud. ` +
|
|
316
|
+
`This test case was likely migrated from Data Center and retains its original project key prefix. ` +
|
|
317
|
+
`POST /testcases/{key}/testscript requires an active project. ` +
|
|
318
|
+
`Please ask your Zephyr Scale admin to re-enable the project, or recreate this test case under an active Cloud project.`
|
|
319
|
+
);
|
|
299
320
|
}
|
|
300
321
|
|
|
301
322
|
// Primary path succeeded — optionally rename
|