targetprocess-mcp-server 2.0.6 → 2.1.6
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 +46 -2
- package/build/tp.js +11 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -332,9 +332,53 @@ server.registerTool('get_release_open_user_stories', {
|
|
|
332
332
|
}],
|
|
333
333
|
};
|
|
334
334
|
});
|
|
335
|
+
server.registerTool('search_user_stories_by_keyword', {
|
|
336
|
+
title: 'Search related user stories by keyword or phrase partial text in description',
|
|
337
|
+
description: `Searches related user stories by keyword or phrase or partial name or partial keyphrase in description e.g. "Text Element", "Fonts"
|
|
338
|
+
NOTE: after results are returned, try filter results by most relevant to what user is looking for in the description text`,
|
|
339
|
+
inputSchema: {
|
|
340
|
+
keyword: z.string()
|
|
341
|
+
.describe('Keyword or partial name or keyphrase to search for in description'),
|
|
342
|
+
},
|
|
343
|
+
}, async ({ keyword }) => {
|
|
344
|
+
const results = await tp.searchContainsDescriptionText({ text: keyword, entityType: "UserStories" });
|
|
345
|
+
if (!results) {
|
|
346
|
+
return {
|
|
347
|
+
content: [{
|
|
348
|
+
type: 'text',
|
|
349
|
+
text: `Failed to search for keyword: "${keyword}"\n JSON: ${JSON.stringify(results, null, 2)}`
|
|
350
|
+
}],
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
const items = results.Items || [];
|
|
354
|
+
if (items.length == 0) {
|
|
355
|
+
return {
|
|
356
|
+
content: [{
|
|
357
|
+
type: 'text',
|
|
358
|
+
text: `Failed to find card by keyword: "${keyword}"\n JSON: ${JSON.stringify(results, null, 2)}`
|
|
359
|
+
}],
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const parsedItems = items.map((item) => {
|
|
363
|
+
const dom = new JSDOM(`<html><body><div id="content">${item.Description}</div></body></html>`);
|
|
364
|
+
const descriptionText = dom.window.document.getElementById('content')?.textContent;
|
|
365
|
+
return {
|
|
366
|
+
title: item.Name,
|
|
367
|
+
id: item.Id,
|
|
368
|
+
description: descriptionText,
|
|
369
|
+
};
|
|
370
|
+
});
|
|
371
|
+
return {
|
|
372
|
+
content: [{
|
|
373
|
+
type: 'text',
|
|
374
|
+
text: JSON.stringify(parsedItems)
|
|
375
|
+
}],
|
|
376
|
+
};
|
|
377
|
+
});
|
|
335
378
|
server.registerTool('search_all_cards_by_keyword', {
|
|
336
379
|
title: 'Search TP cards (user stories, bugs, features) by keyword or partial name',
|
|
337
|
-
description: `Searches tp cards (user stories, bugs, features) by keyword or partial name or partial keyphrase e.g. "Text Element"
|
|
380
|
+
description: `Searches tp cards (user stories, bugs, features) by keyword or partial name or partial keyphrase e.g. "Text Element"
|
|
381
|
+
NOTE: this is a fallback tool if "search_user_stories_by_keyword" tool does not satisfy the user's query`,
|
|
338
382
|
inputSchema: {
|
|
339
383
|
keyword: z.string()
|
|
340
384
|
.describe('Keyword or partial name or keyphrase to search for'),
|
|
@@ -1030,7 +1074,7 @@ server.registerTool('write_test_cases', {
|
|
|
1030
1074
|
- name: concise action-oriented title
|
|
1031
1075
|
- description: HTML <div> with Preconditions and Test Type sections only (no steps here)
|
|
1032
1076
|
- steps: ordered array of { description: "<step action>", result: "<expected result>" }
|
|
1033
|
-
4) Call "create_test_plan" tool passing: resourceId (the card id), resourceType, testPlanTitle (use the card name/title)
|
|
1077
|
+
4) Call "create_test_plan" tool passing: resourceId (the card id), resourceType, testPlanTitle (use the card name/title), NOTE: IF test plan already exists - skip this step and proceed to step 5.
|
|
1034
1078
|
5) Call "add_test_cases_to_test_plan" tool passing: testPlanId (the test plan id), and the testCases array with name, description, and steps`,
|
|
1035
1079
|
inputSchema: {
|
|
1036
1080
|
resourceId: z.string()
|
package/build/tp.js
CHANGED
|
@@ -43,6 +43,7 @@ export class TpClient {
|
|
|
43
43
|
async get(params) {
|
|
44
44
|
params.param["access_token"] = this.token;
|
|
45
45
|
let _url = this.params(params);
|
|
46
|
+
console.error(JSON.stringify({ "TP_URL": _url }, null, 2));
|
|
46
47
|
try {
|
|
47
48
|
const response = await fetch(_url, {
|
|
48
49
|
method: "GET",
|
|
@@ -290,6 +291,16 @@ export class TpClient {
|
|
|
290
291
|
},
|
|
291
292
|
});
|
|
292
293
|
}
|
|
294
|
+
async searchContainsDescriptionText({ text, entityType }) {
|
|
295
|
+
return this.get({
|
|
296
|
+
pathParam: { [entityType]: '' },
|
|
297
|
+
param: {
|
|
298
|
+
"where": `Description contains '${text}' and EntityState.Name eq 'Done'`,
|
|
299
|
+
"format": "json",
|
|
300
|
+
"take": "50",
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}
|
|
293
304
|
async getCurrentReleases() {
|
|
294
305
|
return this.get({
|
|
295
306
|
pathParam: { "Releases": '' },
|