targetprocess-mcp-server 1.0.18 → 1.0.20

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 CHANGED
@@ -56,6 +56,7 @@ server.registerTool('get_user_story_content', {
56
56
  description: '',
57
57
  feature: userStory.Feature?.Name,
58
58
  featureId: userStory.Feature?.Id,
59
+ customFields: userStory.CustomFields,
59
60
  };
60
61
  try {
61
62
  const dom = new JSDOM(`<html><body><div id="content">${description}</div></body></html>`);
@@ -734,7 +735,7 @@ server.registerTool('get_not_covered_user_stories_in_feature', {
734
735
  .describe('TP feature ID (e.g. 145636)'),
735
736
  },
736
737
  }, async ({ id }) => {
737
- const response = await tp.getUserStoriesByFeatureId(id);
738
+ const response = await tp.getUserStoriesIdsByFeatureId(id);
738
739
  if (!response) {
739
740
  return {
740
741
  content: [{
@@ -752,24 +753,33 @@ server.registerTool('get_not_covered_user_stories_in_feature', {
752
753
  }],
753
754
  };
754
755
  }
755
- const userStoriesPromise = userStoriesIds.map((id) => tp.getUserStory(id));
756
+ const userStoriesPromise = userStoriesIds.map((item) => tp.getUserStory(item.id));
756
757
  let userStoriesResults = [];
757
758
  try {
758
- userStoriesResults = await Promise.all(userStoriesPromise);
759
+ const results = await Promise.all(userStoriesPromise);
760
+ userStoriesResults = results.map((item) => item).flat();
759
761
  }
760
762
  catch (error) {
761
763
  console.error("Error getting user stories:", error);
762
764
  return {
763
765
  content: [{
764
766
  type: 'text',
765
- text: `Failed to get user stories for feature id: ${id}`,
767
+ text: `Failed to get user stories for feature id: ${id}. Error: ${error}.`
768
+ }],
769
+ };
770
+ }
771
+ if (userStoriesResults.length === 0) {
772
+ return {
773
+ content: [{
774
+ type: 'text',
775
+ text: `No user stories promise found for feature id: ${id}`,
766
776
  }],
767
777
  };
768
778
  }
769
779
  let userStories = [];
770
780
  try {
771
781
  for (const userStory of userStoriesResults) {
772
- const covered = userStory.CustomFields.find((field) => field.Name === "Test Automation")?.Value === "Done";
782
+ const covered = userStory?.CustomFields.find((field) => field.Name === "Test Automation")?.Value === "Done";
773
783
  userStories.push({
774
784
  id: userStory.Id,
775
785
  name: userStory.Name,
@@ -779,21 +789,21 @@ server.registerTool('get_not_covered_user_stories_in_feature', {
779
789
  covered,
780
790
  });
781
791
  }
782
- if (userStories.length === 0) {
783
- return {
784
- content: [{
785
- type: 'text',
786
- text: `No user stories unable to convert to TP card found for feature id: ${id}`,
787
- }],
788
- };
789
- }
790
792
  }
791
793
  catch (error) {
792
794
  console.error("Error getting user stories:", error);
793
795
  return {
794
796
  content: [{
795
797
  type: 'text',
796
- text: `Failed to get user stories array for feature id: ${id}`,
798
+ text: `Failed to get user stories array for feature id: ${id}: Error: ${error}.`
799
+ }],
800
+ };
801
+ }
802
+ if (userStories.length === 0) {
803
+ return {
804
+ content: [{
805
+ type: 'text',
806
+ text: `No user stories unable to convert to TP card found for feature id: ${id}`,
797
807
  }],
798
808
  };
799
809
  }
package/build/tp.js CHANGED
@@ -328,7 +328,7 @@ export class TpClient {
328
328
  apiVersion: this.v2
329
329
  });
330
330
  }
331
- async getUserStoriesByFeatureId(featureId) {
331
+ async getUserStoriesIdsByFeatureId(featureId) {
332
332
  return this.get({
333
333
  pathParam: { "userstories": '' },
334
334
  param: {
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "node": ">=20.x"
27
27
  },
28
- "version": "1.0.18",
28
+ "version": "1.0.20",
29
29
  "description": "MCP server for Tartget Process",
30
30
  "main": "build/index.js",
31
31
  "keywords": [