backlog-mcp-server 0.8.1 → 0.9.0
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
3
|
+
import { buildToolSchema } from '../types/tool.js';
|
|
4
|
+
const deleteDocumentSchema = buildToolSchema((t) => ({
|
|
5
|
+
documentId: z
|
|
6
|
+
.string()
|
|
7
|
+
.describe(t('TOOL_DELETE_DOCUMENT_DOCUMENT_ID', 'Document ID')),
|
|
8
|
+
}));
|
|
9
|
+
export const deleteDocumentTool = (backlog, { t }) => {
|
|
10
|
+
return {
|
|
11
|
+
name: 'delete_document',
|
|
12
|
+
description: t('TOOL_DELETE_DOCUMENT_DESCRIPTION', 'Permanently deletes a document. This is irreversible (hard delete) and the document cannot be recovered. Unlike the Backlog UI trash feature, this operation does not move the document to trash.'),
|
|
13
|
+
schema: z.object(deleteDocumentSchema(t)),
|
|
14
|
+
outputSchema: DocumentItemSchema,
|
|
15
|
+
handler: async ({ documentId }) => {
|
|
16
|
+
return backlog.deleteDocument(documentId);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { ActivitySchema, ActivityTypeSchema, } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
+
const getUserRecentUpdatesSchema = buildToolSchema((t) => ({
|
|
5
|
+
userId: z
|
|
6
|
+
.number()
|
|
7
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_USER_ID', 'ID of the user to retrieve activities for')),
|
|
8
|
+
activityTypeId: z
|
|
9
|
+
.array(ActivityTypeSchema)
|
|
10
|
+
.optional()
|
|
11
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_ACTIVITY_TYPE_ID', 'Activity type IDs to filter by')),
|
|
12
|
+
minId: z
|
|
13
|
+
.number()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_MIN_ID', 'Minimum activity ID')),
|
|
16
|
+
maxId: z
|
|
17
|
+
.number()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_MAX_ID', 'Maximum activity ID')),
|
|
20
|
+
count: z
|
|
21
|
+
.number()
|
|
22
|
+
.min(1)
|
|
23
|
+
.max(100)
|
|
24
|
+
.default(20)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_COUNT', 'Number of activities to retrieve (1-100, default: 20)')),
|
|
27
|
+
order: z
|
|
28
|
+
.enum(['asc', 'desc'])
|
|
29
|
+
.default('desc')
|
|
30
|
+
.optional()
|
|
31
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_ORDER', 'Sort order ("asc" or "desc", default: "desc")')),
|
|
32
|
+
}));
|
|
33
|
+
export const getUserRecentUpdatesTool = (backlog, { t }) => {
|
|
34
|
+
return {
|
|
35
|
+
name: 'get_user_recent_updates',
|
|
36
|
+
description: t('TOOL_GET_USER_RECENT_UPDATES_DESCRIPTION', 'Returns recent updates (activities) for a specific user'),
|
|
37
|
+
schema: z.object(getUserRecentUpdatesSchema(t)),
|
|
38
|
+
outputSchema: ActivitySchema,
|
|
39
|
+
importantFields: ['id', 'type', 'content', 'created'],
|
|
40
|
+
handler: async ({ userId, activityTypeId, minId, maxId, count, order }) => backlog.getUserActivities(userId, {
|
|
41
|
+
activityTypeId,
|
|
42
|
+
minId,
|
|
43
|
+
maxId,
|
|
44
|
+
count,
|
|
45
|
+
order,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { StarCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
+
const getUserStarsCountSchema = buildToolSchema((t) => ({
|
|
5
|
+
userId: z
|
|
6
|
+
.number()
|
|
7
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_USER_ID', 'User ID')),
|
|
8
|
+
since: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_SINCE', 'Count stars received after this date (yyyy-MM-dd)')),
|
|
12
|
+
until: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_UNTIL', 'Count stars received before this date (yyyy-MM-dd)')),
|
|
16
|
+
}));
|
|
17
|
+
export const getUserStarsCountTool = (backlog, { t }) => {
|
|
18
|
+
return {
|
|
19
|
+
name: 'get_user_stars_count',
|
|
20
|
+
description: t('TOOL_GET_USER_STARS_COUNT_DESCRIPTION', 'Returns the count of stars received by a user'),
|
|
21
|
+
schema: z.object(getUserStarsCountSchema(t)),
|
|
22
|
+
outputSchema: StarCountSchema,
|
|
23
|
+
handler: async ({ userId, since, until }) => backlog.getUserStarsCount(userId, { since, until }),
|
|
24
|
+
};
|
|
25
|
+
};
|
package/build/tools/tools.js
CHANGED
|
@@ -29,7 +29,9 @@ import { getPullRequestsCountTool } from './getPullRequestsCount.js';
|
|
|
29
29
|
import { getResolutionsTool } from './getResolutions.js';
|
|
30
30
|
import { getSpaceTool } from './getSpace.js';
|
|
31
31
|
import { getSpaceActivitiesTool } from './getSpaceActivities.js';
|
|
32
|
+
import { getUserStarsCountTool } from './getUserStarsCount.js';
|
|
32
33
|
import { getUsersTool } from './getUsers.js';
|
|
34
|
+
import { getUserRecentUpdatesTool } from './getUserRecentUpdates.js';
|
|
33
35
|
import { getWatchingListCountTool } from './getWatchingListCount.js';
|
|
34
36
|
import { getWatchingListItemsTool } from './getWatchingListItems.js';
|
|
35
37
|
import { addWatchingTool } from './addWatching.js';
|
|
@@ -53,6 +55,7 @@ import { addVersionMilestoneTool } from './addVersionMilestone.js';
|
|
|
53
55
|
import { updateVersionMilestoneTool } from './updateVersionMilestone.js';
|
|
54
56
|
import { deleteVersionTool } from './deleteVersion.js';
|
|
55
57
|
import { addDocumentTool } from './addDocument.js';
|
|
58
|
+
import { deleteDocumentTool } from './deleteDocument.js';
|
|
56
59
|
export const allTools = (backlog, helper) => {
|
|
57
60
|
return {
|
|
58
61
|
toolsets: [
|
|
@@ -64,7 +67,9 @@ export const allTools = (backlog, helper) => {
|
|
|
64
67
|
getSpaceTool(backlog, helper),
|
|
65
68
|
getSpaceActivitiesTool(backlog, helper),
|
|
66
69
|
getUsersTool(backlog, helper),
|
|
70
|
+
getUserStarsCountTool(backlog, helper),
|
|
67
71
|
getMyselfTool(backlog, helper),
|
|
72
|
+
getUserRecentUpdatesTool(backlog, helper),
|
|
68
73
|
],
|
|
69
74
|
},
|
|
70
75
|
{
|
|
@@ -147,6 +152,7 @@ export const allTools = (backlog, helper) => {
|
|
|
147
152
|
getDocumentTreeTool(backlog, helper),
|
|
148
153
|
getDocumentTool(backlog, helper),
|
|
149
154
|
addDocumentTool(backlog, helper),
|
|
155
|
+
deleteDocumentTool(backlog, helper),
|
|
150
156
|
],
|
|
151
157
|
},
|
|
152
158
|
{
|
|
@@ -402,6 +402,9 @@ export const SpaceSchema = z.object({
|
|
|
402
402
|
export const WatchingListCountSchema = z.object({
|
|
403
403
|
count: z.number(),
|
|
404
404
|
});
|
|
405
|
+
export const StarCountSchema = z.object({
|
|
406
|
+
count: z.number(),
|
|
407
|
+
});
|
|
405
408
|
export const WikiListItemSchema = z.object({
|
|
406
409
|
id: z.number(),
|
|
407
410
|
projectId: z.number(),
|