targetprocess-mcp-server 2.6.7 → 2.6.8

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.
@@ -0,0 +1,14 @@
1
+ export async function handleCreateBugBasedOnCard(tp, params) {
2
+ const bugResponse = await tp.createBug(params);
3
+ if (!bugResponse) {
4
+ return {
5
+ content: [{
6
+ type: 'text',
7
+ text: `Failed to create bug "${params.title}"\n JSON: ${JSON.stringify(bugResponse, null, 2)}`
8
+ }],
9
+ };
10
+ }
11
+ return {
12
+ content: [{ type: 'text', text: JSON.stringify(bugResponse) }],
13
+ };
14
+ }
@@ -14,6 +14,7 @@ export async function handleGetBugContent(tp, id) {
14
14
  id: bug.Id,
15
15
  description: '',
16
16
  origin: '',
17
+ release: bug.Release ? { id: bug.Release.Id, name: bug.Release.Name } : null,
17
18
  };
18
19
  try {
19
20
  const dom = new JSDOM(`<html><body><div id="content">${bug.Description}</div></body></html>`);
package/build/index.js CHANGED
@@ -25,6 +25,7 @@ import { handleAddComment } from "./handlers/add_comment.js";
25
25
  import { handleGetUserStoryComments } from "./handlers/get_user_story_comments.js";
26
26
  import { handleGetBugComments } from "./handlers/get_bug_comments.js";
27
27
  import { handleCreateBug } from "./handlers/create_bug.js";
28
+ import { handleCreateBugBasedOnCard } from "./handlers/create_bug_based_on_card.js";
28
29
  import { handleCreateUserStory } from "./handlers/create_user_story.js";
29
30
  import { handleCreateFormattedUserStory } from "./handlers/create_formatted_user_story.js";
30
31
  import { handleCreateFormattedFeature } from "./handlers/create_formatted_feature.js";
@@ -354,7 +355,8 @@ server.registerTool('create_bug_based_on_card', {
354
355
  3) format the new bug inside html <div> tags with Environment (describes where bug was found, dev, feature, review or uat Environment), Issue Description, Steps to Reproduce, Expected Behavior, Actual Behavior and Attachments sections (note: section titles should be wrapped in <h3> tags, e.g. <h3>Issue Description</h3>);
355
356
  4) IF the user specified a team by name (not ID), call "get_teams" to find the matching team and use its ID as teamId;
356
357
  5) IF the user specified a project by name (not ID), call "get_projects" to find the matching project and use its ID as projectId;
357
- 6) add a comment to the card with created bug Id and its Title`,
358
+ 6) IF the user specified a release by name (not ID), call "get_current_releases" to find the matching release and use its ID as releaseId;
359
+ 7) add a comment to the card with created bug Id and its Title`,
358
360
  inputSchema: {
359
361
  title: z.string()
360
362
  .describe('Bug card title that summarizes the problem in concise, descriptive, and actionable manner, enabling a developer to understand the issue without opening the report'),
@@ -384,6 +386,11 @@ server.registerTool('create_bug_based_on_card', {
384
386
  ])
385
387
  .optional()
386
388
  .describe('Where the bug was found, defaults to "Manual QA" if no origin was specified'),
389
+ releaseId: z.string()
390
+ .min(5)
391
+ .max(9)
392
+ .optional()
393
+ .describe('Optional Release ID to assign this bug to — if user gave a release name, resolve it via "get_current_releases" first'),
387
394
  projectId: z.string()
388
395
  .optional()
389
396
  .describe('Optional Project ID — if user gave a project name, resolve it via "get_projects" first; defaults to TP_PROJECT_ID from config'),
@@ -391,23 +398,7 @@ server.registerTool('create_bug_based_on_card', {
391
398
  .optional()
392
399
  .describe('Optional Team ID — if user gave a team name, resolve it via "get_teams" first; defaults to TP_TEAM_ID from config'),
393
400
  },
394
- }, async ({ title, card, bugContent, origin, projectId, teamId }) => {
395
- const bugResponse = await tp.createBug({ title, card, bugContent, origin, projectId, teamId });
396
- if (!bugResponse) {
397
- return {
398
- content: [{
399
- type: 'text',
400
- text: `Failed to create bug "${title}"\n JSON: ${JSON.stringify(bugResponse, null, 2)}`
401
- }]
402
- };
403
- }
404
- return {
405
- content: [{
406
- type: 'text',
407
- text: JSON.stringify(bugResponse)
408
- }],
409
- };
410
- });
401
+ }, async ({ title, card, bugContent, origin, releaseId, projectId, teamId }) => handleCreateBugBasedOnCard(tp, { title, card, bugContent, origin, releaseId, projectId, teamId }));
411
402
  server.registerTool('update_bug', {
412
403
  title: 'Update a bug card',
413
404
  description: `Update a bug card with data proded from user input.
@@ -416,7 +407,8 @@ server.registerTool('update_bug', {
416
407
  1) IF the user specified a team by name (not ID), call "get_teams" to find the matching team and use its ID as teamId;
417
408
  2) IF the user specified a project by name (not ID), call "get_projects" to find the matching project and use its ID as projectId;
418
409
  3) IF the user specified a state by name (not ID), call "get_bug_workflows" to find the matching state and use its ID as entityStateId;
419
- 4) IF the user specified a sprint/iteration by name, call "get_team_iterations" to find the matching iteration and use its ID as teamIterationId;`,
410
+ 4) IF the user specified a sprint/iteration by name, call "get_team_iterations" to find the matching iteration and use its ID as teamIterationId;
411
+ 5) IF the user specified a release by name (not ID), call "get_current_releases" to find the matching release and use its ID as releaseId;`,
420
412
  inputSchema: {
421
413
  id: z.string()
422
414
  .min(5)
@@ -441,6 +433,11 @@ server.registerTool('update_bug', {
441
433
  ])
442
434
  .optional()
443
435
  .describe('Where the bug was found, defaults to "Manual QA"'),
436
+ releaseId: z.string()
437
+ .min(5)
438
+ .max(9)
439
+ .optional()
440
+ .describe('Optional Release ID to assign this bug to — if user gave a release name, resolve it via "get_current_releases" first'),
444
441
  projectId: z.string()
445
442
  .optional()
446
443
  .describe('Optional Project ID — if user gave a project name, resolve it via "get_projects" first; defaults to TP_PROJECT_ID from config'),
@@ -457,7 +454,7 @@ server.registerTool('update_bug', {
457
454
  .optional()
458
455
  .describe('Optional Team Iteration (sprint) ID — resolve it via "get_team_iterations" first'),
459
456
  },
460
- }, async ({ id, title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }) => handleUpdateBug(tp, { id, title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }));
457
+ }, async ({ id, title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }) => handleUpdateBug(tp, { id, title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }));
461
458
  server.registerTool('update_user_story_state', {
462
459
  title: 'Update a user story card sub state',
463
460
  description: `Update a user story card sub state with data provided from user input.
@@ -480,6 +477,34 @@ server.registerTool('update_user_story_state', {
480
477
  .describe('Team Assignment ID, resolve it via "get_user_story_content" first'),
481
478
  },
482
479
  }, async ({ id, teamId, teamAssignmentId, entityStateId }) => handleUpdateUserStorySubState(tp, { id, teamId, teamAssignmentId, entityStateId }));
480
+ server.registerTool('set_business_value', {
481
+ title: 'Set Business Value on a TP card',
482
+ description: `Set the Business Value (Priority) on a Targetprocess User Story, Feature, or Epic.
483
+ Business Value in the TP UI maps to the Priority field in the API.
484
+ CRITICAL WORKFLOW: Call "get_priorities" first to retrieve the list of valid priority IDs and their names for this instance before calling this tool — do not guess priority IDs.`,
485
+ inputSchema: {
486
+ id: z.string()
487
+ .describe('ID of the card to update (e.g. "151282")'),
488
+ entityType: z.enum(['UserStories', 'Features', 'Epics'])
489
+ .describe('Entity type of the card'),
490
+ priorityId: z.string()
491
+ .describe('Priority ID — resolve via "get_priorities" first'),
492
+ },
493
+ }, async ({ id, entityType, priorityId }) => {
494
+ const response = await tp.setBusinessValue({ id, entityType, priorityId });
495
+ if (!response) {
496
+ return { content: [{ type: 'text', text: `Failed to set business value on ${entityType} ${id}` }] };
497
+ }
498
+ return { content: [{ type: 'text', text: JSON.stringify(response) }] };
499
+ });
500
+ server.registerTool('get_priorities', {
501
+ title: 'Get available Business Value / Priority options',
502
+ description: `Returns the list of Priority options available in this Targetprocess instance. Use this before calling "set_business_value" to resolve a priority name (e.g. "Must Have", "Normal", "10") to its ID.`,
503
+ inputSchema: {},
504
+ }, async () => {
505
+ const response = await tp.getPriorities();
506
+ return { content: [{ type: 'text', text: JSON.stringify(response) }] };
507
+ });
483
508
  server.registerTool('update_user_story', {
484
509
  title: 'Update a user story card',
485
510
  description: `Update a user story card with data provided from user input.
@@ -544,7 +569,8 @@ server.registerTool('create_bug', {
544
569
  1) format the new bug inside html <div> tags with Environment(describes where bug was found, dev, feature, review or uat Environment), Issue Description, Steps to Reproduce, Expected Behavior, Actual Behavior and Attachments sections (note: section titles should be wrapped in <h3> tags, e.g. <h3>Issue Description</h3>, step to reproduce should be wrapped in <ol>);
545
570
  2) IF the user specified a team by name (not ID), call "get_teams" to find the matching team and use its ID as teamId;
546
571
  3) IF the user specified a project by name (not ID), call "get_projects" to find the matching project and use its ID as projectId;
547
- 4) IF the user specified a sprint/iteration by name, call "get_team_iterations" to find the matching iteration and use its ID as teamIterationId;`,
572
+ 4) IF the user specified a sprint/iteration by name, call "get_team_iterations" to find the matching iteration and use its ID as teamIterationId;
573
+ 5) IF the user specified a release by name (not ID), call "get_current_releases" to find the matching release and use its ID as releaseId;`,
548
574
  inputSchema: {
549
575
  title: z.string()
550
576
  .describe('Bug card title that summarizes the problem in concise, descriptive, and actionable manner, enabling a developer to understand the issue without opening the report'),
@@ -563,6 +589,11 @@ server.registerTool('create_bug', {
563
589
  ])
564
590
  .optional()
565
591
  .describe('Where the bug was found, defaults to "Manual QA" if no origin was specified'),
592
+ releaseId: z.string()
593
+ .min(5)
594
+ .max(9)
595
+ .optional()
596
+ .describe('Optional Release ID to assign this bug to — if user gave a release name, resolve it via "get_current_releases" first'),
566
597
  projectId: z.string()
567
598
  .optional()
568
599
  .describe('Optional Project ID — if user gave a project name, resolve it via "get_projects" first; defaults to TP_PROJECT_ID from config'),
@@ -579,7 +610,7 @@ server.registerTool('create_bug', {
579
610
  .optional()
580
611
  .describe('Optional Team Iteration (sprint) ID — resolve it via "get_team_iterations" first'),
581
612
  },
582
- }, async ({ title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }) => handleCreateBug(tp, { title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }));
613
+ }, async ({ title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }) => handleCreateBug(tp, { title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }));
583
614
  server.registerTool('create_user_story', {
584
615
  title: 'Create a new user story',
585
616
  description: `Create a new user story in Targetprocess.
@@ -823,7 +854,7 @@ server.registerTool('create_formatted_feature', {
823
854
  }, async ({ title, header, definitions, scope, nonFunctionalRequirements, crossCuttingScenarios, childStories, openQuestions, references, notes, epicId, releaseId, projectId, teamId }) => handleCreateFormattedFeature(tp, { title, header, definitions, scope, nonFunctionalRequirements, crossCuttingScenarios, childStories, openQuestions, references, notes, epicId, releaseId, projectId, teamId }));
824
855
  server.registerTool('create_feature', {
825
856
  title: 'Create a new feature',
826
- description: `Create a new Feature in Targetprocess.`,
857
+ description: `DEPRECATED use "create_formatted_feature" instead for all new features. Only call this tool when you have a fully pre-written HTML description and the user has explicitly opted out of the structured template.`,
827
858
  inputSchema: {
828
859
  title: z.string()
829
860
  .describe('Feature title'),
package/build/tp.js CHANGED
@@ -186,7 +186,7 @@ export class TpClient {
186
186
  });
187
187
  return response;
188
188
  }
189
- async createBug({ title, card, bugContent, origin, projectId, teamId }) {
189
+ async createBug({ title, card, bugContent, origin, releaseId, projectId, teamId }) {
190
190
  const bug = {
191
191
  "Name": title,
192
192
  "Project": {
@@ -207,6 +207,8 @@ export class TpClient {
207
207
  "value": origin
208
208
  }];
209
209
  }
210
+ if (releaseId)
211
+ bug["Release"] = { "Id": releaseId };
210
212
  if (card.type === "UserStory") {
211
213
  bug["UserStory"] = { "Id": card.id };
212
214
  }
@@ -258,7 +260,14 @@ export class TpClient {
258
260
  param: { "format": "json" },
259
261
  }, userStory);
260
262
  }
261
- async updateBug({ id, title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }) {
263
+ async setBusinessValue({ id, entityType, priorityId }) {
264
+ const entity = { "Id": id, "Priority": { "Id": priorityId } };
265
+ return this.post({
266
+ pathParam: [entityType, id],
267
+ param: { "format": "json" },
268
+ }, entity);
269
+ }
270
+ async updateBug({ id, title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }) {
262
271
  const bug = { "Id": id };
263
272
  if (title)
264
273
  bug["Name"] = title;
@@ -270,6 +279,8 @@ export class TpClient {
270
279
  "type": "DropDown",
271
280
  "value": origin
272
281
  }];
282
+ if (releaseId)
283
+ bug["Release"] = { "Id": releaseId };
273
284
  if (projectId)
274
285
  bug["Project"] = { "Id": projectId };
275
286
  if (teamId)
@@ -289,7 +300,7 @@ export class TpClient {
289
300
  param: { "format": "json" },
290
301
  }, bug);
291
302
  }
292
- async createBugOnly({ title, bugContent, origin, projectId, teamId, entityStateId, tags, teamIterationId }) {
303
+ async createBugOnly({ title, bugContent, origin, releaseId, projectId, teamId, entityStateId, tags, teamIterationId }) {
293
304
  const bug = {
294
305
  "Name": title,
295
306
  "Project": {
@@ -309,6 +320,8 @@ export class TpClient {
309
320
  "value": origin
310
321
  }];
311
322
  }
323
+ if (releaseId)
324
+ bug["Release"] = { "Id": releaseId };
312
325
  if (entityStateId)
313
326
  bug["EntityState"] = { "Id": entityStateId };
314
327
  if (tags)
@@ -878,6 +891,12 @@ export class TpClient {
878
891
  param: { "format": "json" },
879
892
  });
880
893
  }
894
+ async getPriorities() {
895
+ return this.get({
896
+ pathParam: ["Priorities"],
897
+ param: { "format": "json", "take": "200" },
898
+ });
899
+ }
881
900
  async getProcessWorkflows({ processId }) {
882
901
  return this.get({
883
902
  pathParam: ["Process"],
package/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "engines": {
28
28
  "node": ">=20.x"
29
29
  },
30
- "version": "2.6.7",
30
+ "version": "2.6.8",
31
31
  "description": "MCP server for Tartget Process",
32
32
  "main": "build/index.js",
33
33
  "keywords": [