targetprocess-mcp-server 1.0.10 → 1.0.13-a
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/README.md +1 -4
- package/build/index.js +63 -3
- package/build/tp.js +19 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,13 +25,10 @@ It acts as a **bridge between LLM agents and the Targetprocess API**, providing:
|
|
|
25
25
|
- "Show me currently active release"
|
|
26
26
|
- "write me test cases based on 145322 tp user story"
|
|
27
27
|
- "add a comment to 145155 card saying 'test'"
|
|
28
|
-
|
|
29
28
|
- "write test cases based on 145640 user story"
|
|
30
29
|
- "write detailed test cases based on 145642 user story, format them inside html <div> element and add them as a comment"
|
|
31
|
-
|
|
32
30
|
- "create a bug based on 145637 user story where Add Tile flyout (for a Static Tile) not show"
|
|
33
|
-
|
|
34
|
-
- search for a card with 'Text Element' title
|
|
31
|
+
- "search for a card with 'Text Element' title"
|
|
35
32
|
|
|
36
33
|
---
|
|
37
34
|
## Available tools:
|
package/build/index.js
CHANGED
|
@@ -50,12 +50,28 @@ server.registerTool('get_user_story_content', {
|
|
|
50
50
|
}],
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
let userStoryResults = {
|
|
54
|
+
name: userStory.Name,
|
|
55
|
+
id: userStory.Id,
|
|
56
|
+
description: '',
|
|
57
|
+
feature: userStory.Feature?.Name,
|
|
58
|
+
featureId: userStory.Feature?.Id,
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
const dom = new JSDOM(`<html><body><div id="content">${description}</div></body></html>`);
|
|
62
|
+
const descriptionText = dom.window.document.getElementById('content')?.textContent;
|
|
63
|
+
if (descriptionText) {
|
|
64
|
+
userStoryResults.description = descriptionText;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error("Error parsing user story description:", error);
|
|
69
|
+
console.error("Returning user story without description");
|
|
70
|
+
}
|
|
55
71
|
return {
|
|
56
72
|
content: [{
|
|
57
73
|
type: 'text',
|
|
58
|
-
text: JSON.stringify(
|
|
74
|
+
text: JSON.stringify(userStoryResults)
|
|
59
75
|
}],
|
|
60
76
|
};
|
|
61
77
|
});
|
|
@@ -632,6 +648,50 @@ server.registerTool('create_test_plan', {
|
|
|
632
648
|
}],
|
|
633
649
|
};
|
|
634
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
|
+
});
|
|
635
695
|
server.registerTool('get_logged_in_user', {
|
|
636
696
|
title: 'Get logged in user',
|
|
637
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
|
}
|
|
@@ -98,7 +100,7 @@ export class TpClient {
|
|
|
98
100
|
const bug = {
|
|
99
101
|
"Name": title,
|
|
100
102
|
"Project": {
|
|
101
|
-
"Id":
|
|
103
|
+
"Id": config.tp.projectId
|
|
102
104
|
},
|
|
103
105
|
"customFields": [{
|
|
104
106
|
"name": "Origin",
|
|
@@ -107,7 +109,7 @@ export class TpClient {
|
|
|
107
109
|
}],
|
|
108
110
|
"assignedTeams": [{
|
|
109
111
|
"team": {
|
|
110
|
-
"id":
|
|
112
|
+
"id": config.tp.teamId
|
|
111
113
|
}
|
|
112
114
|
}],
|
|
113
115
|
"Description": bugContent,
|
|
@@ -126,7 +128,7 @@ export class TpClient {
|
|
|
126
128
|
const bug = {
|
|
127
129
|
"Name": title,
|
|
128
130
|
"Project": {
|
|
129
|
-
"Id":
|
|
131
|
+
"Id": config.tp.projectId
|
|
130
132
|
},
|
|
131
133
|
"UserStory": {
|
|
132
134
|
"Id": userStoryId
|
|
@@ -138,7 +140,7 @@ export class TpClient {
|
|
|
138
140
|
}],
|
|
139
141
|
"assignedTeams": [{
|
|
140
142
|
"team": {
|
|
141
|
-
"id":
|
|
143
|
+
"id": config.tp.teamId
|
|
142
144
|
}
|
|
143
145
|
}],
|
|
144
146
|
"Description": bugContent,
|
|
@@ -152,7 +154,7 @@ export class TpClient {
|
|
|
152
154
|
const testPlan = {
|
|
153
155
|
"Name": title,
|
|
154
156
|
"Project": {
|
|
155
|
-
"Id":
|
|
157
|
+
"Id": config.tp.projectId
|
|
156
158
|
},
|
|
157
159
|
"LinkedGeneral": {
|
|
158
160
|
"ResourceType": "General",
|
|
@@ -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": '' },
|