targetprocess-mcp-server 2.6.8 → 2.6.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.
- package/build/index.js +16 -0
- package/build/tp.js +13 -2
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -491,6 +491,22 @@ server.registerTool('set_business_value', {
|
|
|
491
491
|
.describe('Priority ID — resolve via "get_priorities" first'),
|
|
492
492
|
},
|
|
493
493
|
}, async ({ id, entityType, priorityId }) => {
|
|
494
|
+
if (entityType === 'UserStories') {
|
|
495
|
+
const story = await tp.getUserStory(id);
|
|
496
|
+
const featureId = story?.Feature?.Id;
|
|
497
|
+
if (featureId) {
|
|
498
|
+
const siblings = await tp.getUserStoriesInFeatureWithPriority(String(featureId));
|
|
499
|
+
const conflict = (siblings?.Items ?? []).find((s) => String(s.Id) !== String(id) && s.Priority?.Id === parseInt(priorityId));
|
|
500
|
+
if (conflict) {
|
|
501
|
+
return {
|
|
502
|
+
content: [{
|
|
503
|
+
type: 'text',
|
|
504
|
+
text: `Cannot set Business Value: story "${conflict.Name}" (${conflict.Id}) in the same feature already has this priority. Choose a different value.`,
|
|
505
|
+
}],
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
494
510
|
const response = await tp.setBusinessValue({ id, entityType, priorityId });
|
|
495
511
|
if (!response) {
|
|
496
512
|
return { content: [{ type: 'text', text: `Failed to set business value on ${entityType} ${id}` }] };
|
package/build/tp.js
CHANGED
|
@@ -267,6 +267,17 @@ export class TpClient {
|
|
|
267
267
|
param: { "format": "json" },
|
|
268
268
|
}, entity);
|
|
269
269
|
}
|
|
270
|
+
async getUserStoriesInFeatureWithPriority(featureId) {
|
|
271
|
+
return this.get({
|
|
272
|
+
pathParam: ["UserStories"],
|
|
273
|
+
param: {
|
|
274
|
+
"format": "json",
|
|
275
|
+
"where": `(Feature.Id eq ${featureId})`,
|
|
276
|
+
"select": "Id,Name,Priority",
|
|
277
|
+
"take": "200",
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
}
|
|
270
281
|
async updateBug({ id, title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }) {
|
|
271
282
|
const bug = { "Id": id };
|
|
272
283
|
if (title)
|
|
@@ -286,11 +297,11 @@ export class TpClient {
|
|
|
286
297
|
if (teamId)
|
|
287
298
|
bug["assignedTeams"] = [{
|
|
288
299
|
"team": {
|
|
289
|
-
"
|
|
300
|
+
"Id": teamId || config.tp.teamId
|
|
290
301
|
}
|
|
291
302
|
}];
|
|
292
303
|
if (entityStateId)
|
|
293
|
-
bug["entityState"] = { "
|
|
304
|
+
bug["entityState"] = { "Id": entityStateId };
|
|
294
305
|
if (tags)
|
|
295
306
|
bug["Tags"] = tags;
|
|
296
307
|
if (teamIterationId)
|