targetprocess-mcp-server 1.0.12 → 1.0.13

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
@@ -648,6 +648,50 @@ server.registerTool('create_test_plan', {
648
648
  }],
649
649
  };
650
650
  });
651
+ server.registerTool('get_feature_user_stories', {
652
+ title: 'Get feature user stories',
653
+ description: 'Get user stories for a TP feature by its ID',
654
+ inputSchema: {
655
+ id: z.string()
656
+ .min(5)
657
+ .max(6)
658
+ .describe('TP feature ID (e.g. 145636)'),
659
+ },
660
+ }, async ({ id }) => {
661
+ const response = await tp.getFeatureUserStories(id);
662
+ if (!response) {
663
+ return {
664
+ content: [{
665
+ type: 'text',
666
+ text: `Failed to get user stories for feature id: ${id}`
667
+ }],
668
+ };
669
+ }
670
+ const items = response.items || [];
671
+ if (items.length === 0) {
672
+ return {
673
+ content: [{
674
+ type: 'text',
675
+ text: `No user stories found in outer items for feature id: ${id}`,
676
+ }],
677
+ };
678
+ }
679
+ const featureItems = items[0].items || [];
680
+ if (items.length === 0) {
681
+ return {
682
+ content: [{
683
+ type: 'text',
684
+ text: `No user stories found for feature id: ${id}`,
685
+ }],
686
+ };
687
+ }
688
+ return {
689
+ content: [{
690
+ type: 'text',
691
+ text: JSON.stringify(featureItems)
692
+ }],
693
+ };
694
+ });
651
695
  server.registerTool('get_logged_in_user', {
652
696
  title: 'Get logged in user',
653
697
  description: 'Get logged in user',
package/build/tp.js CHANGED
@@ -3,6 +3,8 @@ export class TpClient {
3
3
  baseUrl = config.tp.url;
4
4
  token = config.tp.token;
5
5
  headers;
6
+ v1 = '/api/v1';
7
+ v2 = '/api/v2';
6
8
  constructor() {
7
9
  this.headers = {
8
10
  "Content-Type": "application/json",
@@ -10,7 +12,7 @@ export class TpClient {
10
12
  };
11
13
  }
12
14
  params(params) {
13
- let _url = this.baseUrl;
15
+ let _url = this.baseUrl + (params.apiVersion ?? this.v1);
14
16
  for (const [key, value] of Object.entries(params.pathParam)) {
15
17
  _url += value ? `/${key}/${value}` : `/${key}`;
16
18
  }
@@ -296,6 +298,17 @@ export class TpClient {
296
298
  }
297
299
  });
298
300
  }
301
+ async getFeatureUserStories(featureId) {
302
+ return this.get({
303
+ pathParam: { "features": '' },
304
+ param: {
305
+ "format": "json",
306
+ "where": `(id==${featureId})`,
307
+ "select": `{userStories}`,
308
+ },
309
+ apiVersion: this.v2
310
+ });
311
+ }
299
312
  async getContext() {
300
313
  return this.get({
301
314
  pathParam: { "Context": '' },
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "node": ">=20.x"
27
27
  },
28
- "version": "1.0.12",
28
+ "version": "1.0.13",
29
29
  "description": "MCP server for Tartget Process",
30
30
  "main": "build/index.js",
31
31
  "keywords": [