backlog-mcp-server 0.16.0 → 0.18.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.
Files changed (157) hide show
  1. package/README.ja.md +15 -32
  2. package/README.md +20 -32
  3. package/build/auth/oauthRoutes.js +53 -1
  4. package/build/createBacklogMcpServer.d.ts +4 -6
  5. package/build/createBacklogMcpServer.js +4 -12
  6. package/build/handlers/builders/composeToolHandler.d.ts +1 -1
  7. package/build/handlers/builders/composeToolHandler.js +15 -9
  8. package/build/handlers/transformers/wrapWithFieldPicking.d.ts +14 -1
  9. package/build/handlers/transformers/wrapWithFieldPicking.js +30 -36
  10. package/build/index.js +30 -16
  11. package/build/lib.d.ts +1 -1
  12. package/build/loadDescriptionOverrides.d.ts +0 -13
  13. package/build/loadDescriptionOverrides.js +73 -11
  14. package/build/reportUnknownOverrideKeys.d.ts +22 -0
  15. package/build/reportUnknownOverrideKeys.js +42 -0
  16. package/build/tools/addDocument.d.ts +2 -2
  17. package/build/tools/addDocument.js +17 -2
  18. package/build/tools/addIssue.d.ts +2 -2
  19. package/build/tools/addIssue.js +32 -2
  20. package/build/tools/addIssueComment.d.ts +2 -2
  21. package/build/tools/addIssueComment.js +14 -2
  22. package/build/tools/addProject.d.ts +2 -2
  23. package/build/tools/addProject.js +22 -2
  24. package/build/tools/addPullRequest.d.ts +2 -2
  25. package/build/tools/addPullRequest.js +26 -2
  26. package/build/tools/addPullRequestComment.d.ts +2 -2
  27. package/build/tools/addPullRequestComment.js +12 -2
  28. package/build/tools/addRelatedIssue.d.ts +2 -2
  29. package/build/tools/addRelatedIssue.js +33 -2
  30. package/build/tools/addVersionMilestone.d.ts +2 -2
  31. package/build/tools/addVersionMilestone.js +12 -2
  32. package/build/tools/addWatching.d.ts +2 -2
  33. package/build/tools/addWatching.js +12 -2
  34. package/build/tools/addWiki.d.ts +2 -2
  35. package/build/tools/addWiki.js +16 -2
  36. package/build/tools/countIssues.d.ts +2 -2
  37. package/build/tools/countIssues.js +3 -2
  38. package/build/tools/deleteIssue.d.ts +2 -2
  39. package/build/tools/deleteIssue.js +32 -2
  40. package/build/tools/deleteProject.d.ts +2 -2
  41. package/build/tools/deleteProject.js +22 -2
  42. package/build/tools/deleteVersion.d.ts +2 -2
  43. package/build/tools/deleteVersion.js +12 -2
  44. package/build/tools/deleteWatching.d.ts +2 -2
  45. package/build/tools/deleteWatching.js +12 -2
  46. package/build/tools/getCategories.d.ts +2 -2
  47. package/build/tools/getCategories.js +8 -2
  48. package/build/tools/getCustomFields.d.ts +2 -2
  49. package/build/tools/getCustomFields.js +22 -2
  50. package/build/tools/getDocument.d.ts +2 -2
  51. package/build/tools/getDocument.js +17 -2
  52. package/build/tools/getDocumentTree.d.ts +2 -2
  53. package/build/tools/getDocumentTree.js +7 -2
  54. package/build/tools/getDocuments.d.ts +2 -2
  55. package/build/tools/getDocuments.js +17 -2
  56. package/build/tools/getGitRepositories.d.ts +2 -2
  57. package/build/tools/getGitRepositories.js +17 -2
  58. package/build/tools/getGitRepository.d.ts +2 -2
  59. package/build/tools/getGitRepository.js +17 -2
  60. package/build/tools/getIssue.d.ts +2 -2
  61. package/build/tools/getIssue.js +32 -2
  62. package/build/tools/getIssueComments.d.ts +2 -2
  63. package/build/tools/getIssueComments.js +14 -2
  64. package/build/tools/getIssueTypes.d.ts +2 -2
  65. package/build/tools/getIssueTypes.js +11 -2
  66. package/build/tools/getIssues.d.ts +10 -10
  67. package/build/tools/getIssues.js +32 -2
  68. package/build/tools/getMyself.d.ts +2 -2
  69. package/build/tools/getMyself.js +11 -2
  70. package/build/tools/getNotifications.d.ts +2 -2
  71. package/build/tools/getNotifications.js +15 -2
  72. package/build/tools/getNotificationsCount.d.ts +2 -2
  73. package/build/tools/getNotificationsCount.js +5 -2
  74. package/build/tools/getPriorities.d.ts +2 -2
  75. package/build/tools/getPriorities.js +3 -2
  76. package/build/tools/getProject.d.ts +2 -2
  77. package/build/tools/getProject.js +22 -2
  78. package/build/tools/getProjectList.d.ts +2 -2
  79. package/build/tools/getProjectList.js +22 -2
  80. package/build/tools/getProjectUsers.d.ts +2 -2
  81. package/build/tools/getProjectUsers.js +11 -2
  82. package/build/tools/getPullRequest.d.ts +2 -2
  83. package/build/tools/getPullRequest.js +26 -2
  84. package/build/tools/getPullRequestComments.d.ts +2 -2
  85. package/build/tools/getPullRequestComments.js +12 -2
  86. package/build/tools/getPullRequests.d.ts +2 -2
  87. package/build/tools/getPullRequests.js +26 -2
  88. package/build/tools/getPullRequestsCount.d.ts +2 -2
  89. package/build/tools/getPullRequestsCount.js +5 -2
  90. package/build/tools/getRelatedIssues.d.ts +2 -2
  91. package/build/tools/getRelatedIssues.js +33 -2
  92. package/build/tools/getResolutions.d.ts +2 -2
  93. package/build/tools/getResolutions.js +3 -2
  94. package/build/tools/getSpace.d.ts +2 -2
  95. package/build/tools/getSpace.js +13 -2
  96. package/build/tools/getSpaceActivities.d.ts +2 -2
  97. package/build/tools/getSpaceActivities.js +12 -2
  98. package/build/tools/getUserRecentUpdates.d.ts +2 -2
  99. package/build/tools/getUserRecentUpdates.js +12 -2
  100. package/build/tools/getUserStarsCount.d.ts +2 -2
  101. package/build/tools/getUserStarsCount.js +3 -2
  102. package/build/tools/getUsers.d.ts +2 -2
  103. package/build/tools/getUsers.js +11 -2
  104. package/build/tools/getVersionMilestoneList.d.ts +2 -2
  105. package/build/tools/getVersionMilestoneList.js +12 -2
  106. package/build/tools/getWatchingListCount.d.ts +2 -2
  107. package/build/tools/getWatchingListCount.js +5 -2
  108. package/build/tools/getWatchingListItems.d.ts +2 -2
  109. package/build/tools/getWatchingListItems.js +12 -2
  110. package/build/tools/getWiki.d.ts +2 -2
  111. package/build/tools/getWiki.js +16 -2
  112. package/build/tools/getWikiPages.d.ts +2 -2
  113. package/build/tools/getWikiPages.js +12 -2
  114. package/build/tools/getWikisCount.d.ts +2 -2
  115. package/build/tools/getWikisCount.js +3 -2
  116. package/build/tools/markNotificationAsRead.d.ts +6 -1
  117. package/build/tools/markNotificationAsRead.js +6 -1
  118. package/build/tools/markWatchingAsRead.d.ts +6 -1
  119. package/build/tools/markWatchingAsRead.js +6 -1
  120. package/build/tools/removeRelatedIssue.d.ts +2 -2
  121. package/build/tools/removeRelatedIssue.js +33 -2
  122. package/build/tools/resetUnreadNotificationCount.d.ts +2 -2
  123. package/build/tools/resetUnreadNotificationCount.js +5 -2
  124. package/build/tools/updateIssue.d.ts +2 -2
  125. package/build/tools/updateIssue.js +32 -2
  126. package/build/tools/updateIssueComment.d.ts +2 -2
  127. package/build/tools/updateIssueComment.js +14 -2
  128. package/build/tools/updateProject.d.ts +2 -2
  129. package/build/tools/updateProject.js +22 -2
  130. package/build/tools/updatePullRequest.d.ts +2 -2
  131. package/build/tools/updatePullRequest.js +26 -2
  132. package/build/tools/updatePullRequestComment.d.ts +2 -2
  133. package/build/tools/updatePullRequestComment.js +12 -2
  134. package/build/tools/updateVersionMilestone.d.ts +2 -2
  135. package/build/tools/updateVersionMilestone.js +12 -2
  136. package/build/tools/updateWatching.d.ts +2 -2
  137. package/build/tools/updateWatching.js +12 -2
  138. package/build/tools/updateWiki.d.ts +2 -2
  139. package/build/tools/updateWiki.js +16 -2
  140. package/build/types/outputFields.d.ts +26 -0
  141. package/build/types/outputFields.js +3 -0
  142. package/build/types/tool.d.ts +21 -8
  143. package/build/types/zod/activityType.d.ts +38 -0
  144. package/build/types/zod/activityType.js +38 -0
  145. package/build/utils/fieldSelection.d.ts +22 -0
  146. package/build/utils/fieldSelection.js +40 -0
  147. package/build/utils/toolsetUtils.d.ts +1 -3
  148. package/build/utils/toolsetUtils.js +0 -12
  149. package/package.json +4 -4
  150. package/build/tools/dynamicTools/toolsets.d.ts +0 -15
  151. package/build/tools/dynamicTools/toolsets.js +0 -103
  152. package/build/types/zod/backlogOutputDefinition.d.ts +0 -3334
  153. package/build/types/zod/backlogOutputDefinition.js +0 -483
  154. package/build/utils/generateFieldsDescription.d.ts +0 -5
  155. package/build/utils/generateFieldsDescription.js +0 -50
  156. package/build/utils/toolRegistrar.d.ts +0 -5
  157. package/build/utils/toolRegistrar.js +0 -12
@@ -1,483 +0,0 @@
1
- import { z } from 'zod';
2
- export const TextFormattingRuleSchema = z.enum(['backlog', 'markdown']);
3
- export const RoleTypeSchema = z.union([
4
- z.nativeEnum({
5
- Admin: 1,
6
- User: 2,
7
- Reporter: 3,
8
- Viewer: 4,
9
- GuestReporter: 5,
10
- GuestViewer: 6,
11
- }),
12
- z.nativeEnum({
13
- Admin: 1,
14
- MemberOrGuest: 2,
15
- MemberOrGuestForAddIssues: 3,
16
- MemberOrGuestForViewIssues: 4,
17
- }),
18
- ]);
19
- export const LanguageSchema = z.union([
20
- z.literal('en'),
21
- z.literal('ja'),
22
- z.null(),
23
- ]);
24
- export const ActivityTypeSchema = z.nativeEnum({
25
- Undefined: -1,
26
- IssueCreated: 1,
27
- IssueUpdated: 2,
28
- IssueCommented: 3,
29
- IssueDeleted: 4,
30
- WikiCreated: 5,
31
- WikiUpdated: 6,
32
- WikiDeleted: 7,
33
- FileAdded: 8,
34
- FileUpdated: 9,
35
- FileDeleted: 10,
36
- SvnCommitted: 11,
37
- GitPushed: 12,
38
- GitRepositoryCreated: 13,
39
- IssueMultiUpdated: 14,
40
- ProjectUserAdded: 15,
41
- ProjectUserRemoved: 16,
42
- NotifyAdded: 17,
43
- PullRequestAdded: 18,
44
- PullRequestUpdated: 19,
45
- PullRequestCommented: 20,
46
- PullRequestMerged: 21,
47
- MilestoneCreated: 22,
48
- MilestoneUpdated: 23,
49
- MilestoneDeleted: 24,
50
- ProjectGroupAdded: 25,
51
- ProjectGroupDeleted: 26,
52
- });
53
- export const IssueTypeColorSchema = z.enum([
54
- '#e30000',
55
- '#990000',
56
- '#934981',
57
- '#814fbc',
58
- '#2779ca',
59
- '#007e9a',
60
- '#7ea800',
61
- '#ff9200',
62
- '#ff3265',
63
- '#666665',
64
- ]);
65
- export const ProjectStatusColorSchema = z.enum([
66
- '#ea2c00',
67
- '#e87758',
68
- '#e07b9a',
69
- '#868cb7',
70
- '#3b9dbd',
71
- '#4caf93',
72
- '#b0be3c',
73
- '#eda62a',
74
- '#f42858',
75
- '#393939',
76
- ]);
77
- export const CustomFieldTypeSchema = z.nativeEnum({
78
- Text: 1,
79
- TextArea: 2,
80
- Numeric: 3,
81
- Date: 4,
82
- SingleList: 5,
83
- MultipleList: 6,
84
- CheckBox: 7,
85
- Radio: 8,
86
- });
87
- export const UserSchema = z.object({
88
- id: z.number(),
89
- userId: z.string(),
90
- name: z.string(),
91
- roleType: RoleTypeSchema,
92
- lang: LanguageSchema,
93
- mailAddress: z.string(),
94
- lastLoginTime: z.string(),
95
- });
96
- export const ProjectStatusSchema = z.object({
97
- id: z.number(),
98
- projectId: z.number(),
99
- name: z.string(),
100
- color: ProjectStatusColorSchema,
101
- displayOrder: z.number(),
102
- });
103
- export const CategorySchema = z.object({
104
- id: z.number(),
105
- projectId: z.number(),
106
- name: z.string(),
107
- displayOrder: z.number(),
108
- });
109
- export const IssueFileInfoSchema = z.object({
110
- id: z.number(),
111
- name: z.string(),
112
- size: z.number(),
113
- createdUser: UserSchema,
114
- created: z.string(),
115
- });
116
- export const StarSchema = z.object({
117
- id: z.number(),
118
- comment: z.string().optional(),
119
- url: z.string(),
120
- title: z.string(),
121
- presenter: UserSchema,
122
- created: z.string(),
123
- });
124
- export const IssueTypeSchema = z.object({
125
- id: z.number(),
126
- projectId: z.number(),
127
- name: z.string(),
128
- color: IssueTypeColorSchema,
129
- displayOrder: z.number(),
130
- templateSummary: z.string().optional(),
131
- templateDescription: z.string().optional(),
132
- });
133
- export const ResolutionSchema = z.object({
134
- id: z.number(),
135
- name: z.string(),
136
- });
137
- export const PrioritySchema = z.object({
138
- id: z.number(),
139
- name: z.string(),
140
- });
141
- export const VersionSchema = z.object({
142
- id: z.number(),
143
- projectId: z.number(),
144
- name: z.string(),
145
- description: z.string().optional(),
146
- startDate: z.string().optional(),
147
- releaseDueDate: z.string().optional(),
148
- archived: z.boolean(),
149
- displayOrder: z.number(),
150
- });
151
- export const CustomFieldSchema = z.object({
152
- id: z.number(),
153
- projectId: z.number(),
154
- typeId: CustomFieldTypeSchema,
155
- name: z.string(),
156
- description: z.string(),
157
- required: z.boolean(),
158
- applicableIssueTypes: z.array(z.number()),
159
- });
160
- // A custom field *value* attached to an issue (as returned by the Backlog API),
161
- // as opposed to a custom field *definition* (CustomFieldSchema above). The
162
- // concrete `value` shape depends on the field type, so it is left unconstrained.
163
- export const CustomFieldValueSchema = z.object({
164
- id: z.number(),
165
- fieldTypeId: CustomFieldTypeSchema,
166
- name: z.string(),
167
- value: z.unknown(),
168
- // Present on "checkbox" / "radio" fields that allow free-text input for an
169
- // "other" option; holds whatever the user typed there (null when unused).
170
- otherValue: z.string().nullable().optional(),
171
- });
172
- export const SharedFileSchema = z.object({
173
- id: z.number(),
174
- projectId: z.number(),
175
- type: z.string(),
176
- dir: z.string(),
177
- name: z.string(),
178
- size: z.number(),
179
- createdUser: UserSchema,
180
- created: z.string(),
181
- updatedUser: UserSchema,
182
- updated: z.string(),
183
- });
184
- export const IssueSchema = z.object({
185
- id: z.number(),
186
- projectId: z.number(),
187
- issueKey: z.string(),
188
- keyId: z.number(),
189
- issueType: IssueTypeSchema,
190
- summary: z.string(),
191
- description: z.string(),
192
- resolution: ResolutionSchema.optional(),
193
- priority: PrioritySchema,
194
- status: ProjectStatusSchema,
195
- assignee: UserSchema.optional(),
196
- category: z.array(CategorySchema),
197
- versions: z.array(VersionSchema),
198
- milestone: z.array(VersionSchema),
199
- startDate: z.string().optional(),
200
- dueDate: z.string().optional(),
201
- estimatedHours: z.number().optional(),
202
- actualHours: z.number().optional(),
203
- parentIssueId: z.number().optional(),
204
- createdUser: UserSchema,
205
- created: z.string(),
206
- updatedUser: UserSchema,
207
- updated: z.string(),
208
- customFields: z.array(CustomFieldValueSchema),
209
- attachments: z.array(IssueFileInfoSchema),
210
- sharedFiles: z.array(SharedFileSchema),
211
- stars: z.array(StarSchema),
212
- });
213
- // An issue plus the relation type that links it to the issue it was fetched from.
214
- export const RelatedIssueSchema = IssueSchema.extend({
215
- type: z.string(),
216
- });
217
- export const ProjectSchema = z.object({
218
- id: z.number(),
219
- projectKey: z.string(),
220
- name: z.string(),
221
- chartEnabled: z.boolean(),
222
- useResolvedForChart: z.boolean(),
223
- subtaskingEnabled: z.boolean(),
224
- projectLeaderCanEditProjectLeader: z.boolean(),
225
- useWiki: z.boolean(),
226
- useFileSharing: z.boolean(),
227
- useWikiTreeView: z.boolean(),
228
- useOriginalImageSizeAtWiki: z.boolean(),
229
- useSubversion: z.boolean(),
230
- useGit: z.boolean(),
231
- textFormattingRule: TextFormattingRuleSchema,
232
- archived: z.boolean(),
233
- displayOrder: z.number(),
234
- useDevAttributes: z.boolean(),
235
- });
236
- export const AttachmentInfoSchema = z.object({
237
- id: z.number(),
238
- type: z.string(),
239
- });
240
- export const AttributeInfoSchema = z.object({
241
- id: z.number(),
242
- typeId: z.number(),
243
- });
244
- export const NotificationInfoSchema = z.object({
245
- type: z.string(),
246
- });
247
- export const IssueChangeLogSchema = z.object({
248
- field: z.string(),
249
- newValue: z.string(),
250
- originalValue: z.string(),
251
- attachmentInfo: AttachmentInfoSchema,
252
- attributeInfo: AttributeInfoSchema,
253
- notificationInfo: NotificationInfoSchema,
254
- });
255
- export const CommentNotificationSchema = z.object({
256
- id: z.number(),
257
- alreadyRead: z.boolean(),
258
- reason: z.number(),
259
- user: UserSchema,
260
- resourceAlreadyRead: z.boolean(),
261
- });
262
- export const IssueCommentSchema = z.object({
263
- id: z.number(),
264
- projectId: z.number(),
265
- issueId: z.number(),
266
- content: z.string(),
267
- changeLog: z.array(IssueChangeLogSchema),
268
- createdUser: UserSchema,
269
- created: z.string(),
270
- updated: z.string(),
271
- stars: z.array(StarSchema),
272
- notifications: z.array(CommentNotificationSchema),
273
- });
274
- export const PullRequestStatusSchema = z.object({
275
- id: z.number(),
276
- name: z.string(),
277
- });
278
- export const PullRequestFileInfoSchema = z.object({
279
- id: z.number(),
280
- name: z.string(),
281
- size: z.number(),
282
- createdUser: UserSchema,
283
- created: z.string(),
284
- });
285
- export const ChangeLogSchema = z.object({
286
- field: z.string(),
287
- newValue: z.string(),
288
- originalValue: z.string(),
289
- });
290
- export const PullRequestChangeLogSchema = ChangeLogSchema;
291
- export const PullRequestSchema = z.object({
292
- id: z.number(),
293
- projectId: z.number(),
294
- repositoryId: z.number(),
295
- number: z.number(),
296
- summary: z.string(),
297
- description: z.string(),
298
- base: z.string(),
299
- branch: z.string(),
300
- status: PullRequestStatusSchema,
301
- assignee: UserSchema.optional(),
302
- issue: IssueSchema,
303
- baseCommit: z.string().optional(),
304
- branchCommit: z.string().optional(),
305
- mergeCommit: z.string().optional(),
306
- closeAt: z.string().optional(),
307
- mergeAt: z.string().optional(),
308
- createdUser: UserSchema,
309
- created: z.string(),
310
- updatedUser: UserSchema,
311
- updated: z.string(),
312
- attachments: z.array(PullRequestFileInfoSchema),
313
- stars: z.array(StarSchema),
314
- });
315
- export const PullRequestCommentSchema = z.object({
316
- id: z.number(),
317
- content: z.string(),
318
- changeLog: z.array(PullRequestChangeLogSchema),
319
- createdUser: UserSchema,
320
- created: z.string(),
321
- updated: z.string(),
322
- stars: z.array(StarSchema),
323
- notifications: z.array(CommentNotificationSchema),
324
- });
325
- export const WikiFileInfoSchema = z.object({
326
- id: z.number(),
327
- name: z.string(),
328
- size: z.number(),
329
- createdUser: UserSchema,
330
- created: z.string(),
331
- });
332
- export const TagSchema = z.object({
333
- id: z.number(),
334
- name: z.string(),
335
- });
336
- export const WikiSchema = z.object({
337
- id: z.number(),
338
- projectId: z.number(),
339
- name: z.string(),
340
- content: z.string(),
341
- tags: z.array(TagSchema),
342
- attachments: z.array(WikiFileInfoSchema),
343
- sharedFiles: z.array(SharedFileSchema),
344
- stars: z.array(StarSchema),
345
- createdUser: UserSchema,
346
- created: z.string(),
347
- updatedUser: UserSchema,
348
- updated: z.string(),
349
- });
350
- export const IssueCountSchema = z.object({
351
- count: z.number(),
352
- });
353
- export const WatchingListItemSchema = z.object({
354
- id: z.number(),
355
- resourceAlreadyRead: z.boolean(),
356
- note: z.string(),
357
- type: z.string(),
358
- issue: IssueSchema,
359
- lastContentUpdated: z.string(),
360
- created: z.string(),
361
- updated: z.string(),
362
- });
363
- export const GitRepositorySchema = z.object({
364
- id: z.number(),
365
- projectId: z.number(),
366
- name: z.string(),
367
- description: z.string(),
368
- hookUrl: z.string().optional(),
369
- httpUrl: z.string(),
370
- sshUrl: z.string(),
371
- displayOrder: z.number(),
372
- pushedAt: z.string().optional(),
373
- createdUser: UserSchema,
374
- created: z.string(),
375
- updatedUser: UserSchema,
376
- updated: z.string(),
377
- });
378
- export const NotificationSchema = z.object({
379
- id: z.number(),
380
- alreadyRead: z.boolean(),
381
- reason: z.number(),
382
- resourceAlreadyRead: z.boolean(),
383
- project: ProjectSchema.optional(),
384
- issue: IssueSchema.optional(),
385
- comment: IssueCommentSchema.optional(),
386
- pullRequest: PullRequestSchema.optional(),
387
- pullRequestComment: PullRequestCommentSchema.optional(),
388
- sender: UserSchema,
389
- created: z.string(),
390
- });
391
- export const ActivitySchema = z.object({
392
- id: z.number(),
393
- project: ProjectSchema,
394
- type: ActivityTypeSchema,
395
- content: z.any(),
396
- notifications: z.array(z.any()),
397
- createdUser: UserSchema,
398
- created: z.string(),
399
- });
400
- export const NotificationCountSchema = z.object({
401
- count: z.number(),
402
- });
403
- export const PullRequestCountSchema = z.object({
404
- count: z.number(),
405
- });
406
- export const SpaceSchema = z.object({
407
- spaceKey: z.string(),
408
- name: z.string(),
409
- ownerId: z.number(),
410
- lang: z.string(),
411
- timezone: z.string(),
412
- reportSendTime: z.string(),
413
- textFormattingRule: TextFormattingRuleSchema,
414
- created: z.string(),
415
- updated: z.string(),
416
- });
417
- export const WatchingListCountSchema = z.object({
418
- count: z.number(),
419
- });
420
- export const StarCountSchema = z.object({
421
- count: z.number(),
422
- });
423
- export const WikiListItemSchema = z.object({
424
- id: z.number(),
425
- projectId: z.number(),
426
- name: z.string(),
427
- tags: z.array(TagSchema),
428
- createdUser: UserSchema,
429
- created: z.string(),
430
- updatedUser: UserSchema,
431
- updated: z.string(),
432
- });
433
- export const WikiCountSchema = z.object({
434
- count: z.number(),
435
- });
436
- export const DocumentTagSchema = z.object({
437
- id: z.number(),
438
- name: z.string(),
439
- });
440
- export const DocumentFileInfoSchema = z.object({
441
- id: z.number(),
442
- name: z.string(),
443
- size: z.number(),
444
- createdUser: UserSchema,
445
- created: z.string(),
446
- });
447
- export const DocumentItemSchema = z.object({
448
- id: z.string(),
449
- projectId: z.number(),
450
- title: z.string(),
451
- plain: z.string(),
452
- json: z.string(),
453
- statusId: z.number(),
454
- emoji: z.string().nullable(),
455
- attachments: z.array(DocumentFileInfoSchema),
456
- tags: z.array(DocumentTagSchema),
457
- createdUser: UserSchema,
458
- created: z.string(),
459
- updatedUser: UserSchema,
460
- updated: z.string(),
461
- });
462
- export const DocumentTreeNodeSchema = z.lazy(() => z.object({
463
- id: z.string(),
464
- name: z.string().optional(),
465
- children: z.array(DocumentTreeNodeSchema),
466
- statusId: z.number().optional(),
467
- emoji: z.string().optional(),
468
- emojiType: z.string().optional(),
469
- updated: z.string().optional(),
470
- }));
471
- export const ActiveTrashTreeSchema = z.object({
472
- id: z.string(),
473
- children: z.array(DocumentTreeNodeSchema),
474
- });
475
- // No `: z.ZodRawShape` annotation here: it erases the concrete shape, so
476
- // `z.infer<typeof DocumentTreeFullSchemaZ>` collapses to Record<string, unknown>
477
- // and backlog-js's DocumentTree (no index signature) stops being assignable.
478
- export const DocumentTreeFullSchema = {
479
- projectId: z.number(),
480
- activeTree: ActiveTrashTreeSchema.optional(),
481
- trashTree: ActiveTrashTreeSchema.optional(),
482
- };
483
- export const DocumentTreeFullSchemaZ = z.object(DocumentTreeFullSchema);
@@ -1,5 +0,0 @@
1
- import { z, ZodRawShape } from 'zod';
2
- /**
3
- * Generate GraphQL like fields and type specs from Zod types
4
- */
5
- export declare function generateFieldsDescription(outputSchema: z.ZodObject<ZodRawShape>, importantFields?: string[], typeName?: string): string;
@@ -1,50 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Generate GraphQL like fields and type specs from Zod types
4
- */
5
- export function generateFieldsDescription(outputSchema, importantFields = [], typeName = 'Output') {
6
- const allFields = Object.keys(outputSchema.shape);
7
- // Generate Example Query
8
- const exampleQueryFields = importantFields.length > 0 ? importantFields : allFields;
9
- // Generate Output Schema
10
- const gqlTypeDef = generateGraphQLType(typeName, outputSchema);
11
- return `
12
- Specify the fields to retrieve using GraphQL query syntax.
13
- Example (query):
14
- {
15
- ${exampleQueryFields.join('\n ')}
16
- }
17
- Output schema (type definition):
18
- ${gqlTypeDef}
19
- `.trim();
20
- }
21
- function generateGraphQLType(typeName, schema) {
22
- const lines = [`type ${typeName} {`];
23
- for (const [key, value] of Object.entries(schema.shape)) {
24
- lines.push(` ${key}: ${mapZodTypeToGraphQLType(value)}`);
25
- }
26
- lines.push('}');
27
- return lines.join('\n');
28
- }
29
- /**
30
- * Zod to graphql
31
- */
32
- function mapZodTypeToGraphQLType(zodType) {
33
- if (zodType instanceof z.ZodString)
34
- return 'String!';
35
- if (zodType instanceof z.ZodNumber)
36
- return 'Int!';
37
- if (zodType instanceof z.ZodBoolean)
38
- return 'Boolean!';
39
- // zod v4 types `.unwrap()` as the core `$ZodType` rather than the classic
40
- // `ZodType`, so the recursive call needs a cast. The runtime value is a
41
- // classic schema either way - only the declared type narrowed.
42
- if (zodType instanceof z.ZodNullable)
43
- return mapZodTypeToGraphQLType(zodType.unwrap()).replace(/!$/, '');
44
- if (zodType instanceof z.ZodOptional)
45
- return mapZodTypeToGraphQLType(zodType.unwrap()).replace(/!$/, '');
46
- // Spec: a nested part is JSON
47
- if (zodType instanceof z.ZodObject)
48
- return 'JSON';
49
- return 'String';
50
- }
@@ -1,5 +0,0 @@
1
- import { MCPOptions } from '../types/mcp.js';
2
- import { ToolRegistrar } from '../types/tool.js';
3
- import { ToolsetGroup } from '../types/toolsets.js';
4
- import { BacklogMCPServer } from './wrapServerWithToolRegistry.js';
5
- export declare function createToolRegistrar(server: BacklogMCPServer, toolsetGroup: ToolsetGroup, options: MCPOptions): ToolRegistrar;
@@ -1,12 +0,0 @@
1
- import { registerTools } from '../registerTools.js';
2
- import { enableToolset } from '../utils/toolsetUtils.js';
3
- export function createToolRegistrar(server, toolsetGroup, options) {
4
- return {
5
- async enableToolsetAndRefresh(toolset) {
6
- const msg = enableToolset(toolsetGroup, toolset);
7
- registerTools(server, toolsetGroup, options);
8
- await server.server.sendToolListChanged();
9
- return msg;
10
- },
11
- };
12
- }