backlog-mcp-server 0.14.0 → 0.15.1

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.
Files changed (123) hide show
  1. package/README.ja.md +24 -16
  2. package/README.md +26 -16
  3. package/build/auth/backlogAuthContext.d.ts +2 -0
  4. package/build/auth/backlogOAuthClient.d.ts +10 -0
  5. package/build/auth/backlogOAuthClient.js +3 -3
  6. package/build/auth/backlogOAuthConfig.d.ts +9 -0
  7. package/build/auth/bearerAuthMiddleware.d.ts +4 -0
  8. package/build/auth/oauthRoutes.d.ts +4 -0
  9. package/build/auth/oauthRoutes.js +12 -5
  10. package/build/auth/tokenStore.d.ts +62 -0
  11. package/build/backlog/backlogErrorHandler.d.ts +2 -0
  12. package/build/backlog/customFields.d.ts +29 -0
  13. package/build/backlog/parseBacklogAPIError.d.ts +8 -0
  14. package/build/createBacklogMcpServer.d.ts +29 -0
  15. package/build/createBacklogMcpServer.js +18 -6
  16. package/build/createTranslationHelper.d.ts +16 -0
  17. package/build/createTranslationHelper.js +7 -11
  18. package/build/handlers/builders/composeToolHandler.d.ts +31 -0
  19. package/build/handlers/builders/composeToolHandler.js +24 -9
  20. package/build/handlers/transformers/wrapWithErrorHandling.d.ts +2 -0
  21. package/build/handlers/transformers/wrapWithFieldPicking.d.ts +4 -0
  22. package/build/handlers/transformers/wrapWithOrganizationContext.d.ts +3 -0
  23. package/build/handlers/transformers/wrapWithTokenLimit.d.ts +2 -0
  24. package/build/handlers/transformers/wrapWithToolResult.d.ts +6 -0
  25. package/build/httpMcpServer.d.ts +22 -0
  26. package/build/httpMcpServer.js +46 -100
  27. package/build/index.d.ts +2 -0
  28. package/build/index.js +33 -10
  29. package/build/lib.d.ts +25 -0
  30. package/build/lib.js +20 -0
  31. package/build/loadTranslationOverrides.d.ts +17 -0
  32. package/build/loadTranslationOverrides.js +24 -0
  33. package/build/registerTools.d.ts +5 -0
  34. package/build/registerTools.js +7 -6
  35. package/build/tools/addDocument.d.ts +15 -0
  36. package/build/tools/addIssue.d.ts +30 -0
  37. package/build/tools/addIssueComment.d.ts +14 -0
  38. package/build/tools/addProject.d.ts +18 -0
  39. package/build/tools/addPullRequest.d.ts +20 -0
  40. package/build/tools/addPullRequestComment.d.ts +16 -0
  41. package/build/tools/addRelatedIssue.d.ts +12 -0
  42. package/build/tools/addVersionMilestone.d.ts +15 -0
  43. package/build/tools/addWatching.d.ts +11 -0
  44. package/build/tools/addWiki.d.ts +13 -0
  45. package/build/tools/countIssues.d.ts +48 -0
  46. package/build/tools/deleteIssue.d.ts +11 -0
  47. package/build/tools/deleteProject.d.ts +11 -0
  48. package/build/tools/deleteVersion.d.ts +12 -0
  49. package/build/tools/deleteWatching.d.ts +10 -0
  50. package/build/tools/dynamicTools/organizations.d.ts +6 -0
  51. package/build/tools/dynamicTools/toolsets.d.ts +15 -0
  52. package/build/tools/getCategories.d.ts +11 -0
  53. package/build/tools/getCustomFields.d.ts +12 -0
  54. package/build/tools/getDocument.d.ts +10 -0
  55. package/build/tools/getDocumentTree.d.ts +10 -0
  56. package/build/tools/getDocuments.d.ts +11 -0
  57. package/build/tools/getGitRepositories.d.ts +11 -0
  58. package/build/tools/getGitRepository.d.ts +13 -0
  59. package/build/tools/getIssue.d.ts +11 -0
  60. package/build/tools/getIssueComments.d.ts +18 -0
  61. package/build/tools/getIssueTypes.d.ts +11 -0
  62. package/build/tools/getIssues.d.ts +75 -0
  63. package/build/tools/getMyself.d.ts +7 -0
  64. package/build/tools/getNotifications.d.ts +16 -0
  65. package/build/tools/getNotificationsCount.d.ts +11 -0
  66. package/build/tools/getPriorities.d.ts +7 -0
  67. package/build/tools/getProject.d.ts +11 -0
  68. package/build/tools/getProjectList.d.ts +11 -0
  69. package/build/tools/getProjectUsers.d.ts +11 -0
  70. package/build/tools/getPullRequest.d.ts +14 -0
  71. package/build/tools/getPullRequestComments.d.ts +21 -0
  72. package/build/tools/getPullRequests.d.ts +19 -0
  73. package/build/tools/getPullRequestsCount.d.ts +17 -0
  74. package/build/tools/getRelatedIssues.d.ts +11 -0
  75. package/build/tools/getResolutions.d.ts +7 -0
  76. package/build/tools/getSpace.d.ts +7 -0
  77. package/build/tools/getSpaceActivities.d.ts +45 -0
  78. package/build/tools/getUserRecentUpdates.d.ts +46 -0
  79. package/build/tools/getUserStarsCount.d.ts +12 -0
  80. package/build/tools/getUsers.d.ts +7 -0
  81. package/build/tools/getVersionMilestoneList.d.ts +11 -0
  82. package/build/tools/getWatchingListCount.d.ts +10 -0
  83. package/build/tools/getWatchingListItems.d.ts +10 -0
  84. package/build/tools/getWiki.d.ts +10 -0
  85. package/build/tools/getWikiPages.d.ts +12 -0
  86. package/build/tools/getWikisCount.d.ts +11 -0
  87. package/build/tools/markNotificationAsRead.d.ts +13 -0
  88. package/build/tools/markWatchingAsRead.d.ts +13 -0
  89. package/build/tools/removeRelatedIssue.d.ts +12 -0
  90. package/build/tools/resetUnreadNotificationCount.d.ts +7 -0
  91. package/build/tools/shared/customFieldFiltersSchema.d.ts +21 -0
  92. package/build/tools/tools.d.ts +4 -0
  93. package/build/tools/updateIssue.d.ts +34 -0
  94. package/build/tools/updateIssue.js +31 -4
  95. package/build/tools/updateIssueComment.d.ts +13 -0
  96. package/build/tools/updateProject.d.ts +21 -0
  97. package/build/tools/updatePullRequest.d.ts +20 -0
  98. package/build/tools/updatePullRequestComment.d.ts +16 -0
  99. package/build/tools/updateVersionMilestone.d.ts +17 -0
  100. package/build/tools/updateWatching.d.ts +11 -0
  101. package/build/tools/updateWiki.d.ts +13 -0
  102. package/build/types/mcp.d.ts +10 -0
  103. package/build/types/result.d.ts +10 -0
  104. package/build/types/tool.d.ts +24 -0
  105. package/build/types/toolsets.d.ts +16 -0
  106. package/build/types/zod/backlogOutputDefinition.d.ts +3334 -0
  107. package/build/types/zod/backlogOutputDefinition.js +3 -16
  108. package/build/utils/backlogClientRegistry.d.ts +28 -0
  109. package/build/utils/backlogClientRegistry.js +4 -0
  110. package/build/utils/backlogOrganizationContext.d.ts +2 -0
  111. package/build/utils/generateFieldsDescription.d.ts +5 -0
  112. package/build/utils/generateFieldsDescription.js +3 -0
  113. package/build/utils/logger.d.ts +2 -0
  114. package/build/utils/logger.js +27 -14
  115. package/build/utils/resolveIdOrKey.d.ts +18 -0
  116. package/build/utils/runToolSafely.d.ts +6 -0
  117. package/build/utils/tokenCounter.d.ts +1 -0
  118. package/build/utils/toolRegistrar.d.ts +5 -0
  119. package/build/utils/toolsetUtils.d.ts +6 -0
  120. package/build/utils/toolsetUtils.js +0 -20
  121. package/build/utils/wrapServerWithToolRegistry.d.ts +6 -0
  122. package/build/utils/wrapServerWithToolRegistry.js +1 -1
  123. package/package.json +15 -5
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { ActivitySchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getSpaceActivitiesSchema: (t: TranslationHelper["t"]) => {
7
+ activityTypeId: z.ZodOptional<z.ZodArray<z.ZodEnum<{
8
+ Undefined: number;
9
+ IssueCreated: number;
10
+ IssueUpdated: number;
11
+ IssueCommented: number;
12
+ IssueDeleted: number;
13
+ WikiCreated: number;
14
+ WikiUpdated: number;
15
+ WikiDeleted: number;
16
+ FileAdded: number;
17
+ FileUpdated: number;
18
+ FileDeleted: number;
19
+ SvnCommitted: number;
20
+ GitPushed: number;
21
+ GitRepositoryCreated: number;
22
+ IssueMultiUpdated: number;
23
+ ProjectUserAdded: number;
24
+ ProjectUserRemoved: number;
25
+ NotifyAdded: number;
26
+ PullRequestAdded: number;
27
+ PullRequestUpdated: number;
28
+ PullRequestCommented: number;
29
+ PullRequestMerged: number;
30
+ MilestoneCreated: number;
31
+ MilestoneUpdated: number;
32
+ MilestoneDeleted: number;
33
+ ProjectGroupAdded: number;
34
+ ProjectGroupDeleted: number;
35
+ }>>>;
36
+ minId: z.ZodOptional<z.ZodNumber>;
37
+ maxId: z.ZodOptional<z.ZodNumber>;
38
+ count: z.ZodOptional<z.ZodNumber>;
39
+ order: z.ZodOptional<z.ZodEnum<{
40
+ asc: "asc";
41
+ desc: "desc";
42
+ }>>;
43
+ };
44
+ export declare const getSpaceActivitiesTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getSpaceActivitiesSchema>, (typeof ActivitySchema)["shape"]>;
45
+ export {};
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { ActivitySchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getUserRecentUpdatesSchema: (t: TranslationHelper["t"]) => {
7
+ userId: z.ZodNumber;
8
+ activityTypeId: z.ZodOptional<z.ZodArray<z.ZodEnum<{
9
+ Undefined: number;
10
+ IssueCreated: number;
11
+ IssueUpdated: number;
12
+ IssueCommented: number;
13
+ IssueDeleted: number;
14
+ WikiCreated: number;
15
+ WikiUpdated: number;
16
+ WikiDeleted: number;
17
+ FileAdded: number;
18
+ FileUpdated: number;
19
+ FileDeleted: number;
20
+ SvnCommitted: number;
21
+ GitPushed: number;
22
+ GitRepositoryCreated: number;
23
+ IssueMultiUpdated: number;
24
+ ProjectUserAdded: number;
25
+ ProjectUserRemoved: number;
26
+ NotifyAdded: number;
27
+ PullRequestAdded: number;
28
+ PullRequestUpdated: number;
29
+ PullRequestCommented: number;
30
+ PullRequestMerged: number;
31
+ MilestoneCreated: number;
32
+ MilestoneUpdated: number;
33
+ MilestoneDeleted: number;
34
+ ProjectGroupAdded: number;
35
+ ProjectGroupDeleted: number;
36
+ }>>>;
37
+ minId: z.ZodOptional<z.ZodNumber>;
38
+ maxId: z.ZodOptional<z.ZodNumber>;
39
+ count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
40
+ order: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
41
+ asc: "asc";
42
+ desc: "desc";
43
+ }>>>;
44
+ };
45
+ export declare const getUserRecentUpdatesTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getUserRecentUpdatesSchema>, (typeof ActivitySchema)["shape"]>;
46
+ export {};
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { StarCountSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getUserStarsCountSchema: (t: TranslationHelper["t"]) => {
7
+ userId: z.ZodNumber;
8
+ since: z.ZodOptional<z.ZodString>;
9
+ until: z.ZodOptional<z.ZodString>;
10
+ };
11
+ export declare const getUserStarsCountTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getUserStarsCountSchema>, (typeof StarCountSchema)["shape"]>;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Backlog } from 'backlog-js';
2
+ import { ToolDefinition } from '../types/tool.js';
3
+ import { TranslationHelper } from '../createTranslationHelper.js';
4
+ import { UserSchema } from '../types/zod/backlogOutputDefinition.js';
5
+ declare const getUsersSchema: (t: TranslationHelper["t"]) => {};
6
+ export declare const getUsersTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getUsersSchema>, (typeof UserSchema)["shape"]>;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getVersionMilestoneListSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ };
10
+ export declare const getVersionMilestoneListTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getVersionMilestoneListSchema>, (typeof VersionSchema)["shape"]>;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WatchingListCountSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getWatchingListCountSchema: (t: TranslationHelper["t"]) => {
7
+ userId: z.ZodNumber;
8
+ };
9
+ export declare const getWatchingListCountTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getWatchingListCountSchema>, (typeof WatchingListCountSchema)["shape"]>;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getWatchingListItemsSchema: (t: TranslationHelper["t"]) => {
7
+ userId: z.ZodNumber;
8
+ };
9
+ export declare const getWatchingListItemsTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getWatchingListItemsSchema>, (typeof WatchingListItemSchema)["shape"]>;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getWikiSchema: (t: TranslationHelper["t"]) => {
7
+ wikiId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
+ };
9
+ export declare const getWikiTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getWikiSchema>, (typeof WikiSchema)["shape"]>;
10
+ export {};
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WikiListItemSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getWikiPagesSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ keyword: z.ZodOptional<z.ZodString>;
10
+ };
11
+ export declare const getWikiPagesTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getWikiPagesSchema>, (typeof WikiListItemSchema)["shape"]>;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WikiCountSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const getWikisCountSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ };
10
+ export declare const getWikisCountTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof getWikisCountSchema>, (typeof WikiCountSchema)["shape"]>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ declare const markNotificationAsReadSchema: (t: TranslationHelper["t"]) => {
6
+ id: z.ZodNumber;
7
+ };
8
+ export declare const MarkNotificationAsReadResultSchema: z.ZodObject<{
9
+ success: z.ZodBoolean;
10
+ message: z.ZodString;
11
+ }, z.core.$strip>;
12
+ export declare const markNotificationAsReadTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof markNotificationAsReadSchema>, (typeof MarkNotificationAsReadResultSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ declare const markWatchingAsReadSchema: (t: TranslationHelper["t"]) => {
6
+ watchId: z.ZodNumber;
7
+ };
8
+ export declare const MarkWatchingAsReadResultSchema: z.ZodObject<{
9
+ success: z.ZodBoolean;
10
+ message: z.ZodString;
11
+ }, z.core.$strip>;
12
+ export declare const markWatchingAsReadTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof markWatchingAsReadSchema>, (typeof MarkWatchingAsReadResultSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { RelatedIssueSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const removeRelatedIssueSchema: (t: TranslationHelper["t"]) => {
7
+ issueId: z.ZodOptional<z.ZodNumber>;
8
+ issueKey: z.ZodOptional<z.ZodString>;
9
+ relatedIssueId: z.ZodNumber;
10
+ };
11
+ export declare const removeRelatedIssueTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof removeRelatedIssueSchema>, (typeof RelatedIssueSchema)["shape"]>;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Backlog } from 'backlog-js';
2
+ import { ToolDefinition } from '../types/tool.js';
3
+ import { TranslationHelper } from '../createTranslationHelper.js';
4
+ import { NotificationCountSchema } from '../types/zod/backlogOutputDefinition.js';
5
+ declare const resetUnreadNotificationCountSchema: (t: TranslationHelper["t"]) => {};
6
+ export declare const resetUnreadNotificationCountTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof resetUnreadNotificationCountSchema>, (typeof NotificationCountSchema)["shape"]>;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { TranslationHelper } from '../../createTranslationHelper.js';
3
+ export declare const buildCustomFieldFilterSchema: (t: TranslationHelper["t"]) => z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ type: z.ZodLiteral<"text">;
5
+ id: z.ZodNumber;
6
+ value: z.ZodString;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ type: z.ZodLiteral<"numeric">;
9
+ id: z.ZodNumber;
10
+ min: z.ZodOptional<z.ZodNumber>;
11
+ max: z.ZodOptional<z.ZodNumber>;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ type: z.ZodLiteral<"date">;
14
+ id: z.ZodNumber;
15
+ min: z.ZodOptional<z.ZodString>;
16
+ max: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ type: z.ZodLiteral<"list">;
19
+ id: z.ZodNumber;
20
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
21
+ }, z.core.$strip>], "type">;
@@ -0,0 +1,4 @@
1
+ import { Backlog } from 'backlog-js';
2
+ import { TranslationHelper } from '../createTranslationHelper.js';
3
+ import { ToolsetGroup } from '../types/toolsets.js';
4
+ export declare const allTools: (backlog: Backlog, helper: TranslationHelper) => ToolsetGroup;
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateIssueSchema: (t: TranslationHelper["t"]) => {
7
+ issueId: z.ZodOptional<z.ZodNumber>;
8
+ issueKey: z.ZodOptional<z.ZodString>;
9
+ summary: z.ZodOptional<z.ZodString>;
10
+ issueTypeId: z.ZodOptional<z.ZodNumber>;
11
+ priorityId: z.ZodOptional<z.ZodNumber>;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ startDate: z.ZodOptional<z.ZodString>;
14
+ dueDate: z.ZodOptional<z.ZodString>;
15
+ estimatedHours: z.ZodOptional<z.ZodNumber>;
16
+ actualHours: z.ZodOptional<z.ZodNumber>;
17
+ categoryId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
18
+ versionId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
19
+ milestoneId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
20
+ statusId: z.ZodOptional<z.ZodNumber>;
21
+ resolutionId: z.ZodOptional<z.ZodNumber>;
22
+ assigneeId: z.ZodOptional<z.ZodNumber>;
23
+ notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
24
+ attachmentId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
25
+ parentIssueId: z.ZodOptional<z.ZodNumber>;
26
+ comment: z.ZodOptional<z.ZodString>;
27
+ customFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
+ id: z.ZodNumber;
29
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>;
30
+ otherValue: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>>;
32
+ };
33
+ export declare const updateIssueTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateIssueSchema>, (typeof IssueSchema)["shape"]>;
34
+ export {};
@@ -47,15 +47,15 @@ const updateIssueSchema = buildToolSchema((t) => ({
47
47
  categoryId: z
48
48
  .array(z.number())
49
49
  .optional()
50
- .describe(t('TOOL_UPDATE_ISSUE_CATEGORY_ID', 'Category IDs')),
50
+ .describe(t('TOOL_UPDATE_ISSUE_CATEGORY_ID', 'Category IDs. Pass an empty array to clear all categories. Omit this field to leave the current categories unchanged.')),
51
51
  versionId: z
52
52
  .array(z.number())
53
53
  .optional()
54
- .describe(t('TOOL_UPDATE_ISSUE_VERSION_ID', 'Version IDs')),
54
+ .describe(t('TOOL_UPDATE_ISSUE_VERSION_ID', 'Version IDs. Pass an empty array to clear all versions. Omit this field to leave the current versions unchanged.')),
55
55
  milestoneId: z
56
56
  .array(z.number())
57
57
  .optional()
58
- .describe(t('TOOL_UPDATE_ISSUE_MILESTONE_ID', 'Milestone IDs')),
58
+ .describe(t('TOOL_UPDATE_ISSUE_MILESTONE_ID', 'Milestone IDs. Pass an empty array to clear all milestones. Omit this field to leave the current milestones unchanged.')),
59
59
  statusId: z
60
60
  .number()
61
61
  .optional()
@@ -106,6 +106,30 @@ const updateIssueSchema = buildToolSchema((t) => ({
106
106
  .optional()
107
107
  .describe(t('TOOL_UPDATE_ISSUE_CUSTOM_FIELDS', 'List of custom fields to set on the issue')),
108
108
  }));
109
+ // Backlog API clears a stored array field (category/version/milestone) only when
110
+ // the parameter is sent as `field[]=` (empty value). backlog-js serializes
111
+ // params via qs with `arrayFormat: 'brackets'`, and an empty array `[]` produces
112
+ // no query string at all, so the API silently ignores it. Converting `[]` to
113
+ // `['']` makes qs emit `field[]=`, which the API interprets as "clear".
114
+ //
115
+ // Only these three are persistent, clearable array fields. notifiedUserId (a
116
+ // one-off notification target) and attachmentId (attachments to add) are action
117
+ // parameters, not stored state, so they are intentionally excluded.
118
+ const CLEARABLE_ARRAY_FIELDS = [
119
+ 'categoryId',
120
+ 'versionId',
121
+ 'milestoneId',
122
+ ];
123
+ const clearEmptyArrayFields = (params) => {
124
+ const next = { ...params };
125
+ for (const field of CLEARABLE_ARRAY_FIELDS) {
126
+ const value = next[field];
127
+ if (Array.isArray(value) && value.length === 0) {
128
+ next[field] = [''];
129
+ }
130
+ }
131
+ return next;
132
+ };
109
133
  export const updateIssueTool = (backlog, { t }) => {
110
134
  return {
111
135
  name: 'update_issue',
@@ -119,9 +143,12 @@ export const updateIssueTool = (backlog, { t }) => {
119
143
  }
120
144
  const customFieldPayload = customFieldsToPayload(customFields);
121
145
  const finalPayload = {
122
- ...params,
146
+ ...clearEmptyArrayFields(params),
123
147
  ...customFieldPayload,
124
148
  };
149
+ // The `['']` clear-sentinel is not representable in backlog-js's
150
+ // `number[]` param types, so cast at this single boundary. qs serializes
151
+ // it to `field[]=`, which the Backlog API accepts as "clear this field".
125
152
  return backlog.patchIssue(result.value, finalPayload);
126
153
  },
127
154
  };
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateIssueCommentSchema: (t: TranslationHelper["t"]) => {
7
+ issueId: z.ZodOptional<z.ZodNumber>;
8
+ issueKey: z.ZodOptional<z.ZodString>;
9
+ commentId: z.ZodNumber;
10
+ content: z.ZodString;
11
+ };
12
+ export declare const updateIssueCommentTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateIssueCommentSchema>, (typeof IssueCommentSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateProjectSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ key: z.ZodOptional<z.ZodString>;
11
+ chartEnabled: z.ZodOptional<z.ZodBoolean>;
12
+ subtaskingEnabled: z.ZodOptional<z.ZodBoolean>;
13
+ projectLeaderCanEditProjectLeader: z.ZodOptional<z.ZodBoolean>;
14
+ textFormattingRule: z.ZodOptional<z.ZodEnum<{
15
+ backlog: "backlog";
16
+ markdown: "markdown";
17
+ }>>;
18
+ archived: z.ZodOptional<z.ZodBoolean>;
19
+ };
20
+ export declare const updateProjectTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateProjectSchema>, (typeof ProjectSchema)["shape"]>;
21
+ export {};
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updatePullRequestSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ repoId: z.ZodOptional<z.ZodNumber>;
10
+ repoName: z.ZodOptional<z.ZodString>;
11
+ number: z.ZodNumber;
12
+ summary: z.ZodOptional<z.ZodString>;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ issueId: z.ZodOptional<z.ZodNumber>;
15
+ assigneeId: z.ZodOptional<z.ZodNumber>;
16
+ notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
17
+ statusId: z.ZodOptional<z.ZodNumber>;
18
+ };
19
+ export declare const updatePullRequestTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updatePullRequestSchema>, (typeof PullRequestSchema)["shape"]>;
20
+ export {};
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updatePullRequestCommentSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ repoId: z.ZodOptional<z.ZodNumber>;
10
+ repoName: z.ZodOptional<z.ZodString>;
11
+ number: z.ZodNumber;
12
+ commentId: z.ZodNumber;
13
+ content: z.ZodString;
14
+ };
15
+ export declare const updatePullRequestCommentTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updatePullRequestCommentSchema>, (typeof PullRequestCommentSchema)["shape"]>;
16
+ export {};
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateVersionMilestoneSchema: (t: TranslationHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ id: z.ZodNumber;
10
+ name: z.ZodString;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ startDate: z.ZodOptional<z.ZodString>;
13
+ releaseDueDate: z.ZodOptional<z.ZodString>;
14
+ archived: z.ZodOptional<z.ZodBoolean>;
15
+ };
16
+ export declare const updateVersionMilestoneTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateVersionMilestoneSchema>, (typeof VersionSchema)["shape"]>;
17
+ export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateWatchingSchema: (t: TranslationHelper["t"]) => {
7
+ watchId: z.ZodNumber;
8
+ note: z.ZodString;
9
+ };
10
+ export declare const updateWatchingTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateWatchingSchema>, (typeof WatchingListItemSchema)["shape"]>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { TranslationHelper } from '../createTranslationHelper.js';
5
+ import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateWikiSchema: (t: TranslationHelper["t"]) => {
7
+ wikiId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ content: z.ZodOptional<z.ZodString>;
10
+ mailNotify: z.ZodOptional<z.ZodBoolean>;
11
+ };
12
+ export declare const updateWikiTool: (backlog: Backlog, { t }: TranslationHelper) => ToolDefinition<ReturnType<typeof updateWikiSchema>, (typeof WikiSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,10 @@
1
+ export type MCPOptions = {
2
+ useFields: boolean;
3
+ maxTokens: number;
4
+ prefix: string;
5
+ /**
6
+ * Whether tools take an `organization` parameter. Only true when more than one
7
+ * Backlog space is configured; see `BacklogClientRegistry.isMultiOrganization`.
8
+ */
9
+ useOrganization: boolean;
10
+ };
@@ -0,0 +1,10 @@
1
+ export type ErrorLike = {
2
+ kind: 'error';
3
+ message: string;
4
+ };
5
+ export type Success<T> = {
6
+ kind: 'ok';
7
+ data: T;
8
+ };
9
+ export type SafeResult<T> = Success<T> | ErrorLike;
10
+ export declare function isErrorLike<T>(res: SafeResult<T>): res is ErrorLike;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { TranslationHelper } from '../createTranslationHelper.js';
3
+ import { CallToolResult } from '@modelcontextprotocol/server';
4
+ export type ToolDefinition<Shape extends z.ZodRawShape, OutputShape extends z.ZodRawShape> = {
5
+ name: string;
6
+ description: string;
7
+ schema: z.ZodObject<Shape>;
8
+ outputSchema: z.ZodObject<OutputShape>;
9
+ handler: (input: z.infer<z.ZodObject<Shape>> & {
10
+ fields?: string;
11
+ organization?: string;
12
+ }) => Promise<z.infer<z.ZodObject<OutputShape>> | z.infer<z.ZodObject<OutputShape>>[]>;
13
+ importantFields?: (keyof z.infer<z.ZodObject<OutputShape>>)[];
14
+ };
15
+ export declare const buildToolSchema: <T extends z.ZodRawShape>(fn: (t: TranslationHelper["t"]) => T) => (t: TranslationHelper["t"]) => T;
16
+ export type DynamicToolDefinition<Shape extends z.ZodRawShape> = {
17
+ name: string;
18
+ description: string;
19
+ schema: z.ZodObject<Shape>;
20
+ handler: (input: z.infer<z.ZodObject<Shape>>) => Promise<CallToolResult>;
21
+ };
22
+ export interface ToolRegistrar {
23
+ enableToolsetAndRefresh(toolset: string): Promise<string>;
24
+ }
@@ -0,0 +1,16 @@
1
+ import { DynamicToolDefinition, ToolDefinition } from './tool.js';
2
+ type BaseToolset<TTool> = {
3
+ name: string;
4
+ description: string;
5
+ enabled: boolean;
6
+ tools: TTool[];
7
+ };
8
+ export type Toolset = BaseToolset<ToolDefinition<any, any>>;
9
+ export type ToolsetGroup = {
10
+ toolsets: Toolset[];
11
+ };
12
+ export type DynamicToolset = BaseToolset<DynamicToolDefinition<any>>;
13
+ export type DynamicToolsetGroup = {
14
+ toolsets: DynamicToolset[];
15
+ };
16
+ export {};