backlog-mcp-server 0.7.0 → 0.8.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.
- package/README.ja.md +89 -41
- package/README.md +102 -43
- package/package.json +15 -10
- package/build/backlog/backlogErrorHandler.js +0 -8
- package/build/backlog/customFields.js +0 -70
- package/build/backlog/parseBacklogAPIError.js +0 -38
- package/build/createTranslationHelper.js +0 -28
- package/build/handlers/builders/composeToolHandler.js +0 -26
- package/build/handlers/transformers/wrapWithErrorHandling.js +0 -4
- package/build/handlers/transformers/wrapWithFieldPicking.js +0 -55
- package/build/handlers/transformers/wrapWithTokenLimit.js +0 -21
- package/build/handlers/transformers/wrapWithToolResult.js +0 -39
- package/build/index.js +0 -101
- package/build/registerTools.js +0 -37
- package/build/tools/addDocument.js +0 -40
- package/build/tools/addIssue.js +0 -97
- package/build/tools/addIssueComment.js +0 -44
- package/build/tools/addProject.js +0 -39
- package/build/tools/addPullRequest.js +0 -65
- package/build/tools/addPullRequestComment.js +0 -52
- package/build/tools/addVersionMilestone.js +0 -51
- package/build/tools/addWatching.js +0 -25
- package/build/tools/addWiki.js +0 -29
- package/build/tools/countIssues.js +0 -105
- package/build/tools/deleteIssue.js +0 -29
- package/build/tools/deleteProject.js +0 -29
- package/build/tools/deleteVersion.js +0 -35
- package/build/tools/deleteWatching.js +0 -17
- package/build/tools/dynamicTools/toolsets.js +0 -103
- package/build/tools/getCategories.js +0 -30
- package/build/tools/getCustomFields.js +0 -37
- package/build/tools/getDocument.js +0 -20
- package/build/tools/getDocumentTree.js +0 -20
- package/build/tools/getDocuments.js +0 -25
- package/build/tools/getGitRepositories.js +0 -29
- package/build/tools/getGitRepository.js +0 -41
- package/build/tools/getIssue.js +0 -29
- package/build/tools/getIssueComments.js +0 -45
- package/build/tools/getIssueTypes.js +0 -30
- package/build/tools/getIssues.js +0 -149
- package/build/tools/getMyself.js +0 -14
- package/build/tools/getNotifications.js +0 -35
- package/build/tools/getNotificationsCount.js +0 -20
- package/build/tools/getPriorities.js +0 -13
- package/build/tools/getProject.js +0 -29
- package/build/tools/getProjectList.js +0 -23
- package/build/tools/getPullRequest.js +0 -44
- package/build/tools/getPullRequestComments.js +0 -60
- package/build/tools/getPullRequests.js +0 -65
- package/build/tools/getPullRequestsCount.js +0 -57
- package/build/tools/getResolutions.js +0 -13
- package/build/tools/getSpace.js +0 -14
- package/build/tools/getUsers.js +0 -14
- package/build/tools/getVersionMilestoneList.js +0 -37
- package/build/tools/getWatchingListCount.js +0 -17
- package/build/tools/getWatchingListItems.js +0 -17
- package/build/tools/getWiki.js +0 -21
- package/build/tools/getWikiPages.js +0 -37
- package/build/tools/getWikisCount.js +0 -29
- package/build/tools/markNotificationAsRead.js +0 -26
- package/build/tools/markWatchingAsRead.js +0 -26
- package/build/tools/resetUnreadNotificationCount.js +0 -13
- package/build/tools/shared/customFieldFiltersSchema.js +0 -78
- package/build/tools/tools.js +0 -163
- package/build/tools/updateIssue.js +0 -119
- package/build/tools/updateProject.js +0 -57
- package/build/tools/updatePullRequest.js +0 -68
- package/build/tools/updatePullRequestComment.js +0 -51
- package/build/tools/updateVersionMilestone.js +0 -57
- package/build/tools/updateWatching.js +0 -18
- package/build/tools/updateWiki.js +0 -37
- package/build/types/mcp.js +0 -1
- package/build/types/result.js +0 -3
- package/build/types/tool.js +0 -1
- package/build/types/toolsets.js +0 -1
- package/build/types/zod/backlogOutputDefinition.js +0 -468
- package/build/utils/generateFieldsDescription.js +0 -47
- package/build/utils/logger.js +0 -20
- package/build/utils/resolveIdOrKey.js +0 -25
- package/build/utils/runToolSafely.js +0 -18
- package/build/utils/tokenCounter.js +0 -11
- package/build/utils/toolRegistrar.js +0 -12
- package/build/utils/toolsetUtils.js +0 -48
- package/build/utils/wrapServerWithToolRegistry.js +0 -16
- package/build/version.js +0 -1
- package/build/version.template.js +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { PullRequestCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getPullRequestsCountSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
repoId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_REPO_ID', 'Repository ID')),
|
|
18
|
-
repoName: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_REPO_NAME', 'Repository name')),
|
|
22
|
-
statusId: z
|
|
23
|
-
.array(z.number())
|
|
24
|
-
.optional()
|
|
25
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_STATUS_ID', 'Status IDs')),
|
|
26
|
-
assigneeId: z
|
|
27
|
-
.array(z.number())
|
|
28
|
-
.optional()
|
|
29
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_ASSIGNEE_ID', 'Assignee user IDs')),
|
|
30
|
-
issueId: z
|
|
31
|
-
.array(z.number())
|
|
32
|
-
.optional()
|
|
33
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_ISSUE_ID', 'Issue IDs')),
|
|
34
|
-
createdUserId: z
|
|
35
|
-
.array(z.number())
|
|
36
|
-
.optional()
|
|
37
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT_CREATED_USER_ID', 'Created user IDs')),
|
|
38
|
-
}));
|
|
39
|
-
export const getPullRequestsCountTool = (backlog, { t }) => {
|
|
40
|
-
return {
|
|
41
|
-
name: 'get_pull_requests_count',
|
|
42
|
-
description: t('TOOL_GET_PULL_REQUESTS_COUNT_DESCRIPTION', 'Returns count of pull requests for a repository'),
|
|
43
|
-
schema: z.object(getPullRequestsCountSchema(t)),
|
|
44
|
-
outputSchema: PullRequestCountSchema,
|
|
45
|
-
handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => {
|
|
46
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
47
|
-
if (!result.ok) {
|
|
48
|
-
throw result.error;
|
|
49
|
-
}
|
|
50
|
-
const repoResult = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
|
|
51
|
-
if (!repoResult.ok) {
|
|
52
|
-
throw repoResult.error;
|
|
53
|
-
}
|
|
54
|
-
return backlog.getPullRequestsCount(result.value, String(repoResult.value), params);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { ResolutionSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getResolutionsSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const getResolutionsTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'get_resolutions',
|
|
8
|
-
description: t('TOOL_GET_RESOLUTIONS_DESCRIPTION', 'Returns list of issue resolutions'),
|
|
9
|
-
schema: z.object(getResolutionsSchema(t)),
|
|
10
|
-
outputSchema: ResolutionSchema,
|
|
11
|
-
handler: async () => backlog.getResolutions(),
|
|
12
|
-
};
|
|
13
|
-
};
|
package/build/tools/getSpace.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { SpaceSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getSpaceSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const getSpaceTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'get_space',
|
|
8
|
-
description: t('TOOL_GET_SPACE_DESCRIPTION', 'Returns information about the Backlog space'),
|
|
9
|
-
schema: z.object(getSpaceSchema(t)),
|
|
10
|
-
outputSchema: SpaceSchema,
|
|
11
|
-
importantFields: ['spaceKey', 'name', 'lang', 'timezone'],
|
|
12
|
-
handler: async () => backlog.getSpace(),
|
|
13
|
-
};
|
|
14
|
-
};
|
package/build/tools/getUsers.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { UserSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getUsersSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const getUsersTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'get_users',
|
|
8
|
-
description: t('TOOL_GET_USERS_DESCRIPTION', 'Returns list of users in the Backlog space'),
|
|
9
|
-
schema: z.object(getUsersSchema(t)),
|
|
10
|
-
outputSchema: UserSchema,
|
|
11
|
-
importantFields: ['userId', 'name', 'roleType', 'lang'],
|
|
12
|
-
handler: async () => backlog.getUsers(),
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getVersionMilestoneListSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_VERSION_MILESTONE_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_VERSION_MILESTONE_PROJECT_KEY', 'The key of the project (e.g., TEST_PROJECT)')),
|
|
14
|
-
}));
|
|
15
|
-
export const getVersionMilestoneListTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_version_milestone_list',
|
|
18
|
-
description: t('TOOL_GET_VERSION_MILESTONE_LIST_DESCRIPTION', 'Returns list of versions/milestones in the Backlog space'),
|
|
19
|
-
schema: z.object(getVersionMilestoneListSchema(t)),
|
|
20
|
-
outputSchema: VersionSchema,
|
|
21
|
-
importantFields: [
|
|
22
|
-
'id',
|
|
23
|
-
'name',
|
|
24
|
-
'description',
|
|
25
|
-
'startDate',
|
|
26
|
-
'releaseDueDate',
|
|
27
|
-
'archived',
|
|
28
|
-
],
|
|
29
|
-
handler: async ({ projectId, projectKey }) => {
|
|
30
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
31
|
-
if (!result.ok) {
|
|
32
|
-
throw result.error;
|
|
33
|
-
}
|
|
34
|
-
return backlog.getVersions(result.value);
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { WatchingListCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getWatchingListCountSchema = buildToolSchema((t) => ({
|
|
5
|
-
userId: z
|
|
6
|
-
.number()
|
|
7
|
-
.describe(t('TOOL_GET_WATCHING_LIST_COUNT_USER_ID', 'User ID')),
|
|
8
|
-
}));
|
|
9
|
-
export const getWatchingListCountTool = (backlog, { t }) => {
|
|
10
|
-
return {
|
|
11
|
-
name: 'get_watching_list_count',
|
|
12
|
-
description: t('TOOL_GET_WATCHING_LIST_COUNT_DESCRIPTION', 'Returns count of watching items for a user'),
|
|
13
|
-
schema: z.object(getWatchingListCountSchema(t)),
|
|
14
|
-
outputSchema: WatchingListCountSchema,
|
|
15
|
-
handler: async ({ userId }) => backlog.getWatchingListCount(userId),
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getWatchingListItemsSchema = buildToolSchema((t) => ({
|
|
5
|
-
userId: z
|
|
6
|
-
.number()
|
|
7
|
-
.describe(t('TOOL_GET_WATCHING_LIST_ITEMS_USER_ID', 'User ID')),
|
|
8
|
-
}));
|
|
9
|
-
export const getWatchingListItemsTool = (backlog, { t }) => {
|
|
10
|
-
return {
|
|
11
|
-
name: 'get_watching_list_items',
|
|
12
|
-
description: t('TOOL_GET_WATCHING_LIST_ITEMS_DESCRIPTION', 'Returns list of watching items for a user'),
|
|
13
|
-
schema: z.object(getWatchingListItemsSchema(t)),
|
|
14
|
-
outputSchema: WatchingListItemSchema,
|
|
15
|
-
handler: async ({ userId }) => backlog.getWatchingListItems(userId),
|
|
16
|
-
};
|
|
17
|
-
};
|
package/build/tools/getWiki.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getWikiSchema = buildToolSchema((t) => ({
|
|
5
|
-
wikiId: z
|
|
6
|
-
.union([z.string(), z.number()])
|
|
7
|
-
.describe(t('TOOL_GET_WIKI_ID', 'Wiki ID')),
|
|
8
|
-
}));
|
|
9
|
-
export const getWikiTool = (backlog, { t }) => {
|
|
10
|
-
return {
|
|
11
|
-
name: 'get_wiki',
|
|
12
|
-
description: t('TOOL_GET_WIKI_DESCRIPTION', 'Returns information about a specific wiki page'),
|
|
13
|
-
schema: z.object(getWikiSchema(t)),
|
|
14
|
-
outputSchema: WikiSchema,
|
|
15
|
-
importantFields: ['id', 'projectId', 'name', 'content'],
|
|
16
|
-
handler: async ({ wikiId }) => {
|
|
17
|
-
const wikiIdNumber = typeof wikiId === 'string' ? parseInt(wikiId, 10) : wikiId;
|
|
18
|
-
return backlog.getWiki(wikiIdNumber);
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { WikiListItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getWikiPagesSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_WIKI_PAGES_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_WIKI_PAGES_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
keyword: z
|
|
15
|
-
.string()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_WIKI_PAGES_KEYWORD', 'Keyword to search for in Wiki pages')),
|
|
18
|
-
}));
|
|
19
|
-
export const getWikiPagesTool = (backlog, { t }) => {
|
|
20
|
-
return {
|
|
21
|
-
name: 'get_wiki_pages',
|
|
22
|
-
description: t('TOOL_GET_WIKI_PAGES_DESCRIPTION', 'Returns list of Wiki pages'),
|
|
23
|
-
schema: z.object(getWikiPagesSchema(t)),
|
|
24
|
-
outputSchema: WikiListItemSchema,
|
|
25
|
-
importantFields: ['projectId', 'name', 'tags'],
|
|
26
|
-
handler: async ({ projectId, projectKey, keyword }) => {
|
|
27
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
28
|
-
if (!result.ok) {
|
|
29
|
-
throw result.error;
|
|
30
|
-
}
|
|
31
|
-
return backlog.getWikis({
|
|
32
|
-
projectIdOrKey: result.value,
|
|
33
|
-
keyword,
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { WikiCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getWikisCountSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_WIKIS_COUNT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_WIKIS_COUNT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
}));
|
|
15
|
-
export const getWikisCountTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_wikis_count',
|
|
18
|
-
description: t('TOOL_GET_WIKIS_COUNT_DESCRIPTION', 'Returns count of wiki pages in a project'),
|
|
19
|
-
schema: z.object(getWikisCountSchema(t)),
|
|
20
|
-
outputSchema: WikiCountSchema,
|
|
21
|
-
handler: async ({ projectId, projectKey }) => {
|
|
22
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
23
|
-
if (!result.ok) {
|
|
24
|
-
throw result.error;
|
|
25
|
-
}
|
|
26
|
-
return backlog.getWikisCount(result.value);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
const markNotificationAsReadSchema = buildToolSchema((t) => ({
|
|
4
|
-
id: z
|
|
5
|
-
.number()
|
|
6
|
-
.describe(t('TOOL_MARK_NOTIFICATION_AS_READ_ID', 'Notification ID to mark as read')),
|
|
7
|
-
}));
|
|
8
|
-
export const MarkNotificationAsReadResultSchema = z.object({
|
|
9
|
-
success: z.boolean(),
|
|
10
|
-
message: z.string(),
|
|
11
|
-
});
|
|
12
|
-
export const markNotificationAsReadTool = (backlog, { t }) => {
|
|
13
|
-
return {
|
|
14
|
-
name: 'mark_notification_as_read',
|
|
15
|
-
description: t('TOOL_MARK_NOTIFICATION_AS_READ_DESCRIPTION', 'Mark a notification as read'),
|
|
16
|
-
schema: z.object(markNotificationAsReadSchema(t)),
|
|
17
|
-
outputSchema: MarkNotificationAsReadResultSchema,
|
|
18
|
-
handler: async ({ id }) => {
|
|
19
|
-
await backlog.markAsReadNotification(id);
|
|
20
|
-
return {
|
|
21
|
-
success: true,
|
|
22
|
-
message: `Notification ${id} marked as read`,
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
const markWatchingAsReadSchema = buildToolSchema((t) => ({
|
|
4
|
-
watchId: z
|
|
5
|
-
.number()
|
|
6
|
-
.describe(t('TOOL_MARK_WATCHING_AS_READ_WATCH_ID', 'Watch ID to mark as read')),
|
|
7
|
-
}));
|
|
8
|
-
export const MarkWatchingAsReadResultSchema = z.object({
|
|
9
|
-
success: z.boolean(),
|
|
10
|
-
message: z.string(),
|
|
11
|
-
});
|
|
12
|
-
export const markWatchingAsReadTool = (backlog, { t }) => {
|
|
13
|
-
return {
|
|
14
|
-
name: 'mark_watching_as_read',
|
|
15
|
-
description: t('TOOL_MARK_WATCHING_AS_READ_DESCRIPTION', 'Mark a watch as read'),
|
|
16
|
-
schema: z.object(markWatchingAsReadSchema(t)),
|
|
17
|
-
outputSchema: MarkWatchingAsReadResultSchema,
|
|
18
|
-
handler: async ({ watchId }) => {
|
|
19
|
-
await backlog.resetWatchingListItemAsRead(watchId);
|
|
20
|
-
return {
|
|
21
|
-
success: true,
|
|
22
|
-
message: `Watch ${watchId} marked as read`,
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { NotificationCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const resetUnreadNotificationCountSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const resetUnreadNotificationCountTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'reset_unread_notification_count',
|
|
8
|
-
description: t('TOOL_RESET_UNREAD_NOTIFICATION_COUNT_DESCRIPTION', 'Reset unread notification count'),
|
|
9
|
-
schema: z.object(resetUnreadNotificationCountSchema(t)),
|
|
10
|
-
outputSchema: NotificationCountSchema,
|
|
11
|
-
handler: async () => backlog.resetNotificationsMarkAsRead(),
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { z, ZodIssueCode } from 'zod';
|
|
2
|
-
export const buildCustomFieldFilterSchema = (t) => {
|
|
3
|
-
const schema = z.discriminatedUnion('type', [
|
|
4
|
-
z
|
|
5
|
-
.object({
|
|
6
|
-
type: z.literal('text'),
|
|
7
|
-
id: z
|
|
8
|
-
.number()
|
|
9
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_ID', 'Custom field ID (e.g., 12345)')),
|
|
10
|
-
value: z
|
|
11
|
-
.string()
|
|
12
|
-
.min(1)
|
|
13
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_TEXT_VALUE', 'Keyword to match for the custom field')),
|
|
14
|
-
})
|
|
15
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_TEXT', 'Text custom field filter')),
|
|
16
|
-
z
|
|
17
|
-
.object({
|
|
18
|
-
type: z.literal('numeric'),
|
|
19
|
-
id: z
|
|
20
|
-
.number()
|
|
21
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_ID', 'Custom field ID (e.g., 12345)')),
|
|
22
|
-
min: z
|
|
23
|
-
.number()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_NUMERIC_MIN', 'Minimum numeric value (inclusive)')),
|
|
26
|
-
max: z
|
|
27
|
-
.number()
|
|
28
|
-
.optional()
|
|
29
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_NUMERIC_MAX', 'Maximum numeric value (inclusive)')),
|
|
30
|
-
})
|
|
31
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_NUMERIC', 'Numeric custom field filter')),
|
|
32
|
-
z
|
|
33
|
-
.object({
|
|
34
|
-
type: z.literal('date'),
|
|
35
|
-
id: z
|
|
36
|
-
.number()
|
|
37
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_ID', 'Custom field ID (e.g., 12345)')),
|
|
38
|
-
min: z
|
|
39
|
-
.string()
|
|
40
|
-
.optional()
|
|
41
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_DATE_MIN', 'Start date (yyyy-MM-dd)')),
|
|
42
|
-
max: z
|
|
43
|
-
.string()
|
|
44
|
-
.optional()
|
|
45
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_DATE_MAX', 'End date (yyyy-MM-dd)')),
|
|
46
|
-
})
|
|
47
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_DATE', 'Date custom field filter')),
|
|
48
|
-
z
|
|
49
|
-
.object({
|
|
50
|
-
type: z.literal('list'),
|
|
51
|
-
id: z
|
|
52
|
-
.number()
|
|
53
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_ID', 'Custom field ID (e.g., 12345)')),
|
|
54
|
-
value: z
|
|
55
|
-
.union([z.number(), z.array(z.number()).min(1)])
|
|
56
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_LIST_VALUE', 'Value ID(s) to match for list-type custom field')),
|
|
57
|
-
})
|
|
58
|
-
.describe(t('TOOL_CUSTOM_FIELD_FILTER_LIST', 'List custom field filter')),
|
|
59
|
-
]);
|
|
60
|
-
return schema.superRefine((data, ctx) => {
|
|
61
|
-
if (data.type === 'numeric' &&
|
|
62
|
-
data.min === undefined &&
|
|
63
|
-
data.max === undefined) {
|
|
64
|
-
ctx.addIssue({
|
|
65
|
-
code: ZodIssueCode.custom,
|
|
66
|
-
message: t('TOOL_CUSTOM_FIELD_FILTER_NUMERIC_REQUIRED', 'Provide at least one of min or max for numeric filters'),
|
|
67
|
-
path: ['min'],
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (data.type === 'date' && !data.min && !data.max) {
|
|
71
|
-
ctx.addIssue({
|
|
72
|
-
code: ZodIssueCode.custom,
|
|
73
|
-
message: t('TOOL_CUSTOM_FIELD_FILTER_DATE_REQUIRED', 'Provide at least one of min or max for date filters'),
|
|
74
|
-
path: ['min'],
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
};
|
package/build/tools/tools.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { addIssueTool } from './addIssue.js';
|
|
2
|
-
import { addIssueCommentTool } from './addIssueComment.js';
|
|
3
|
-
import { addProjectTool } from './addProject.js';
|
|
4
|
-
import { addPullRequestTool } from './addPullRequest.js';
|
|
5
|
-
import { addPullRequestCommentTool } from './addPullRequestComment.js';
|
|
6
|
-
import { addWikiTool } from './addWiki.js';
|
|
7
|
-
import { updateWikiTool } from './updateWiki.js';
|
|
8
|
-
import { countIssuesTool } from './countIssues.js';
|
|
9
|
-
import { deleteIssueTool } from './deleteIssue.js';
|
|
10
|
-
import { deleteProjectTool } from './deleteProject.js';
|
|
11
|
-
import { getCategoriesTool } from './getCategories.js';
|
|
12
|
-
import { getCustomFieldsTool } from './getCustomFields.js';
|
|
13
|
-
import { getGitRepositoriesTool } from './getGitRepositories.js';
|
|
14
|
-
import { getGitRepositoryTool } from './getGitRepository.js';
|
|
15
|
-
import { getIssueTool } from './getIssue.js';
|
|
16
|
-
import { getIssueCommentsTool } from './getIssueComments.js';
|
|
17
|
-
import { getIssuesTool } from './getIssues.js';
|
|
18
|
-
import { getIssueTypesTool } from './getIssueTypes.js';
|
|
19
|
-
import { getMyselfTool } from './getMyself.js';
|
|
20
|
-
import { getNotificationsTool } from './getNotifications.js';
|
|
21
|
-
import { getNotificationsCountTool } from './getNotificationsCount.js';
|
|
22
|
-
import { getPrioritiesTool } from './getPriorities.js';
|
|
23
|
-
import { getProjectTool } from './getProject.js';
|
|
24
|
-
import { getProjectListTool } from './getProjectList.js';
|
|
25
|
-
import { getPullRequestTool } from './getPullRequest.js';
|
|
26
|
-
import { getPullRequestCommentsTool } from './getPullRequestComments.js';
|
|
27
|
-
import { getPullRequestsTool } from './getPullRequests.js';
|
|
28
|
-
import { getPullRequestsCountTool } from './getPullRequestsCount.js';
|
|
29
|
-
import { getResolutionsTool } from './getResolutions.js';
|
|
30
|
-
import { getSpaceTool } from './getSpace.js';
|
|
31
|
-
import { getUsersTool } from './getUsers.js';
|
|
32
|
-
import { getWatchingListCountTool } from './getWatchingListCount.js';
|
|
33
|
-
import { getWatchingListItemsTool } from './getWatchingListItems.js';
|
|
34
|
-
import { addWatchingTool } from './addWatching.js';
|
|
35
|
-
import { updateWatchingTool } from './updateWatching.js';
|
|
36
|
-
import { deleteWatchingTool } from './deleteWatching.js';
|
|
37
|
-
import { markWatchingAsReadTool } from './markWatchingAsRead.js';
|
|
38
|
-
import { getWikiTool } from './getWiki.js';
|
|
39
|
-
import { getWikiPagesTool } from './getWikiPages.js';
|
|
40
|
-
import { getWikisCountTool } from './getWikisCount.js';
|
|
41
|
-
import { markNotificationAsReadTool } from './markNotificationAsRead.js';
|
|
42
|
-
import { resetUnreadNotificationCountTool } from './resetUnreadNotificationCount.js';
|
|
43
|
-
import { updateIssueTool } from './updateIssue.js';
|
|
44
|
-
import { updateProjectTool } from './updateProject.js';
|
|
45
|
-
import { updatePullRequestTool } from './updatePullRequest.js';
|
|
46
|
-
import { updatePullRequestCommentTool } from './updatePullRequestComment.js';
|
|
47
|
-
import { getDocumentTool } from './getDocument.js';
|
|
48
|
-
import { getDocumentsTool } from './getDocuments.js';
|
|
49
|
-
import { getDocumentTreeTool } from './getDocumentTree.js';
|
|
50
|
-
import { getVersionMilestoneListTool } from './getVersionMilestoneList.js';
|
|
51
|
-
import { addVersionMilestoneTool } from './addVersionMilestone.js';
|
|
52
|
-
import { updateVersionMilestoneTool } from './updateVersionMilestone.js';
|
|
53
|
-
import { deleteVersionTool } from './deleteVersion.js';
|
|
54
|
-
import { addDocumentTool } from './addDocument.js';
|
|
55
|
-
export const allTools = (backlog, helper) => {
|
|
56
|
-
return {
|
|
57
|
-
toolsets: [
|
|
58
|
-
{
|
|
59
|
-
name: 'space',
|
|
60
|
-
description: 'Tools for managing Backlog space settings and general information.',
|
|
61
|
-
enabled: false,
|
|
62
|
-
tools: [
|
|
63
|
-
getSpaceTool(backlog, helper),
|
|
64
|
-
getUsersTool(backlog, helper),
|
|
65
|
-
getMyselfTool(backlog, helper),
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'project',
|
|
70
|
-
description: 'Tools for managing projects, categories, custom fields, and issue types.',
|
|
71
|
-
enabled: false,
|
|
72
|
-
tools: [
|
|
73
|
-
getProjectListTool(backlog, helper),
|
|
74
|
-
addProjectTool(backlog, helper),
|
|
75
|
-
getProjectTool(backlog, helper),
|
|
76
|
-
updateProjectTool(backlog, helper),
|
|
77
|
-
deleteProjectTool(backlog, helper),
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'issue',
|
|
82
|
-
description: 'Tools for managing issues and their comments.',
|
|
83
|
-
enabled: false,
|
|
84
|
-
tools: [
|
|
85
|
-
getIssueTool(backlog, helper),
|
|
86
|
-
getIssuesTool(backlog, helper),
|
|
87
|
-
countIssuesTool(backlog, helper),
|
|
88
|
-
addIssueTool(backlog, helper),
|
|
89
|
-
updateIssueTool(backlog, helper),
|
|
90
|
-
deleteIssueTool(backlog, helper),
|
|
91
|
-
getIssueCommentsTool(backlog, helper),
|
|
92
|
-
addIssueCommentTool(backlog, helper),
|
|
93
|
-
getPrioritiesTool(backlog, helper),
|
|
94
|
-
getCategoriesTool(backlog, helper),
|
|
95
|
-
getCustomFieldsTool(backlog, helper),
|
|
96
|
-
getIssueTypesTool(backlog, helper),
|
|
97
|
-
getResolutionsTool(backlog, helper),
|
|
98
|
-
getWatchingListItemsTool(backlog, helper),
|
|
99
|
-
getWatchingListCountTool(backlog, helper),
|
|
100
|
-
addWatchingTool(backlog, helper),
|
|
101
|
-
updateWatchingTool(backlog, helper),
|
|
102
|
-
deleteWatchingTool(backlog, helper),
|
|
103
|
-
markWatchingAsReadTool(backlog, helper),
|
|
104
|
-
getVersionMilestoneListTool(backlog, helper),
|
|
105
|
-
addVersionMilestoneTool(backlog, helper),
|
|
106
|
-
updateVersionMilestoneTool(backlog, helper),
|
|
107
|
-
deleteVersionTool(backlog, helper),
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: 'wiki',
|
|
112
|
-
description: 'Tools for managing wiki pages.',
|
|
113
|
-
enabled: false,
|
|
114
|
-
tools: [
|
|
115
|
-
getWikiPagesTool(backlog, helper),
|
|
116
|
-
getWikisCountTool(backlog, helper),
|
|
117
|
-
getWikiTool(backlog, helper),
|
|
118
|
-
addWikiTool(backlog, helper),
|
|
119
|
-
updateWikiTool(backlog, helper),
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: 'git',
|
|
124
|
-
description: 'Tools for managing Git repositories and pull requests.',
|
|
125
|
-
enabled: false,
|
|
126
|
-
tools: [
|
|
127
|
-
getGitRepositoriesTool(backlog, helper),
|
|
128
|
-
getGitRepositoryTool(backlog, helper),
|
|
129
|
-
getPullRequestsTool(backlog, helper),
|
|
130
|
-
getPullRequestsCountTool(backlog, helper),
|
|
131
|
-
getPullRequestTool(backlog, helper),
|
|
132
|
-
addPullRequestTool(backlog, helper),
|
|
133
|
-
updatePullRequestTool(backlog, helper),
|
|
134
|
-
getPullRequestCommentsTool(backlog, helper),
|
|
135
|
-
addPullRequestCommentTool(backlog, helper),
|
|
136
|
-
updatePullRequestCommentTool(backlog, helper),
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: 'document',
|
|
141
|
-
description: 'Tools for managing documents.',
|
|
142
|
-
enabled: false,
|
|
143
|
-
tools: [
|
|
144
|
-
getDocumentsTool(backlog, helper),
|
|
145
|
-
getDocumentTreeTool(backlog, helper),
|
|
146
|
-
getDocumentTool(backlog, helper),
|
|
147
|
-
addDocumentTool(backlog, helper),
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: 'notifications',
|
|
152
|
-
description: 'Tools for managing user notifications.',
|
|
153
|
-
enabled: false,
|
|
154
|
-
tools: [
|
|
155
|
-
getNotificationsTool(backlog, helper),
|
|
156
|
-
getNotificationsCountTool(backlog, helper),
|
|
157
|
-
resetUnreadNotificationCountTool(backlog, helper),
|
|
158
|
-
markNotificationAsReadTool(backlog, helper),
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
};
|
|
163
|
-
};
|