targetprocess-mcp-server 2.2.11 → 2.2.12
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 +2 -0
- package/build/index.js +83 -0
- package/build/tp.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ Cards — Read
|
|
|
63
63
|
|
|
64
64
|
Cards — Write
|
|
65
65
|
- `add_comment` — Post a comment to any card (id, comment)
|
|
66
|
+
- `add_comment_with_user` — Post a comment to any card and mention a specific user (id, comment, user object from `get_users`)
|
|
66
67
|
- `update_bug` — Update an existing bug (id, optional title, optional bugContent, optional origin, optional projectId, optional teamId, optional entityStateId)
|
|
67
68
|
> Resolve state name → ID via `get_bug_workflows` before passing `entityStateId`
|
|
68
69
|
- `update_user_story` — Update an existing user story (id, optional title, optional description, optional projectId, optional teamId, optional entityStateId)
|
|
@@ -103,6 +104,7 @@ Teams
|
|
|
103
104
|
|
|
104
105
|
User
|
|
105
106
|
- `get_logged_in_user` — Get the currently logged-in user's info (no params needed)
|
|
107
|
+
- `get_users` — Get all Targetprocess users (no params needed)
|
|
106
108
|
|
|
107
109
|
Developer Tools
|
|
108
110
|
- `get_commit_message` — Returns a formatted commit message string for a task or bug ID (id, type: task | bug)
|
package/build/index.js
CHANGED
|
@@ -435,6 +435,89 @@ server.registerTool('get_bug_content', {
|
|
|
435
435
|
}],
|
|
436
436
|
};
|
|
437
437
|
});
|
|
438
|
+
server.registerTool('get_users', {
|
|
439
|
+
title: 'Get users',
|
|
440
|
+
description: 'Get all users',
|
|
441
|
+
}, async () => {
|
|
442
|
+
const response = await tp.getUsers();
|
|
443
|
+
if (!response) {
|
|
444
|
+
return {
|
|
445
|
+
content: [{
|
|
446
|
+
type: 'text',
|
|
447
|
+
text: `Failed to get users, JSON: ${JSON.stringify(response, null, 2)}`
|
|
448
|
+
}],
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
const items = response.Items || [];
|
|
452
|
+
if (items.length === 0) {
|
|
453
|
+
return {
|
|
454
|
+
content: [{
|
|
455
|
+
type: 'text',
|
|
456
|
+
text: `No users found`,
|
|
457
|
+
}],
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
return {
|
|
461
|
+
content: [{
|
|
462
|
+
type: 'text',
|
|
463
|
+
text: JSON.stringify(items)
|
|
464
|
+
}],
|
|
465
|
+
};
|
|
466
|
+
});
|
|
467
|
+
server.registerTool('add_comment_with_user', {
|
|
468
|
+
title: 'Adds provided content to TP card (user story) as a comment',
|
|
469
|
+
description: `Adds provided content as a comment to the specified tp card by id, e.g. 145789 and mentions the user in the comment
|
|
470
|
+
CRITICAL WORKFLOW:
|
|
471
|
+
1) call 'get_users' to get list of available users
|
|
472
|
+
2) find the user by email, first name, or last name in the users list
|
|
473
|
+
`,
|
|
474
|
+
inputSchema: {
|
|
475
|
+
id: z.string()
|
|
476
|
+
.min(5)
|
|
477
|
+
.max(6)
|
|
478
|
+
.describe('TP card id, usually user story or bug ID (e.g. 145789)'),
|
|
479
|
+
comment: z.string()
|
|
480
|
+
.describe('Comment content to add'),
|
|
481
|
+
user: z.object({
|
|
482
|
+
Email: z.string()
|
|
483
|
+
.describe('User email'),
|
|
484
|
+
FirstName: z.string()
|
|
485
|
+
.describe('User first name'),
|
|
486
|
+
LastName: z.string()
|
|
487
|
+
.describe('User last name'),
|
|
488
|
+
IsActive: z.boolean()
|
|
489
|
+
.describe('User is active'),
|
|
490
|
+
})
|
|
491
|
+
.describe('User to add to the comment, from "get_users" tool'),
|
|
492
|
+
},
|
|
493
|
+
}, async ({ id, comment, user }) => {
|
|
494
|
+
try {
|
|
495
|
+
const addCommentResponse = await tp.addCommentWithUser(id, comment, user);
|
|
496
|
+
if (!addCommentResponse) {
|
|
497
|
+
return {
|
|
498
|
+
content: [{
|
|
499
|
+
type: 'text',
|
|
500
|
+
text: `Failed to add comment to user story id: ${id}`
|
|
501
|
+
}]
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
return {
|
|
505
|
+
content: [{
|
|
506
|
+
type: 'text',
|
|
507
|
+
text: JSON.stringify(addCommentResponse)
|
|
508
|
+
}],
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
console.error("Error adding comment to user story:", error);
|
|
513
|
+
return {
|
|
514
|
+
content: [{
|
|
515
|
+
type: 'text',
|
|
516
|
+
text: `Failed to add comment to user story id: ${id}`
|
|
517
|
+
}]
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
});
|
|
438
521
|
server.registerTool('add_comment', {
|
|
439
522
|
title: 'Adds provided content to TP card (user story) as a comment',
|
|
440
523
|
description: `Adds provided content as a comment to the specified tp card by id, e.g. 145789`,
|
package/build/tp.js
CHANGED
|
@@ -310,6 +310,29 @@ export class TpClient {
|
|
|
310
310
|
param: { "format": "json" },
|
|
311
311
|
}, testPlan);
|
|
312
312
|
}
|
|
313
|
+
async getUsers() {
|
|
314
|
+
return this.get({
|
|
315
|
+
pathParam: ["Users"],
|
|
316
|
+
param: { "format": "json" },
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async addCommentWithUser(userStoryId, comment, user) {
|
|
320
|
+
const userAt = user ? `cc - <div>@user:${user.Email}[${user.FirstName} ${user.LastName}] </div>` : '';
|
|
321
|
+
const commentContent = `${comment}\nn${userAt}`;
|
|
322
|
+
const commentData = {
|
|
323
|
+
description: commentContent,
|
|
324
|
+
owner: {
|
|
325
|
+
id: config.tp.ownerId
|
|
326
|
+
},
|
|
327
|
+
general: {
|
|
328
|
+
id: userStoryId,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
return this.post({
|
|
332
|
+
pathParam: ["comments"],
|
|
333
|
+
param: { "format": "json" },
|
|
334
|
+
}, commentData);
|
|
335
|
+
}
|
|
313
336
|
async addComment(userStoryId, comment) {
|
|
314
337
|
const commentData = {
|
|
315
338
|
description: comment,
|