backlog-mcp-server 0.17.0 → 0.18.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 (160) hide show
  1. package/README.ja.md +31 -32
  2. package/README.md +36 -32
  3. package/build/auth/oauthRoutes.js +53 -1
  4. package/build/backlog/customFields.js +12 -9
  5. package/build/createBacklogMcpServer.d.ts +4 -6
  6. package/build/createBacklogMcpServer.js +4 -12
  7. package/build/handlers/builders/composeToolHandler.d.ts +1 -1
  8. package/build/handlers/builders/composeToolHandler.js +15 -9
  9. package/build/handlers/transformers/wrapWithFieldPicking.d.ts +14 -1
  10. package/build/handlers/transformers/wrapWithFieldPicking.js +30 -36
  11. package/build/httpMcpServer.js +8 -1
  12. package/build/index.js +20 -15
  13. package/build/lib.d.ts +1 -1
  14. package/build/loadDescriptionOverrides.js +2 -2
  15. package/build/reportUnknownOverrideKeys.js +0 -1
  16. package/build/tools/addDocument.d.ts +3 -3
  17. package/build/tools/addDocument.js +18 -3
  18. package/build/tools/addIssue.d.ts +3 -3
  19. package/build/tools/addIssue.js +32 -2
  20. package/build/tools/addIssueComment.d.ts +3 -3
  21. package/build/tools/addIssueComment.js +14 -2
  22. package/build/tools/addProject.d.ts +3 -3
  23. package/build/tools/addProject.js +22 -2
  24. package/build/tools/addPullRequest.d.ts +3 -3
  25. package/build/tools/addPullRequest.js +26 -2
  26. package/build/tools/addPullRequestComment.d.ts +3 -3
  27. package/build/tools/addPullRequestComment.js +12 -2
  28. package/build/tools/addRelatedIssue.d.ts +3 -3
  29. package/build/tools/addRelatedIssue.js +33 -2
  30. package/build/tools/addVersionMilestone.d.ts +3 -3
  31. package/build/tools/addVersionMilestone.js +12 -2
  32. package/build/tools/addWatching.d.ts +3 -3
  33. package/build/tools/addWatching.js +12 -2
  34. package/build/tools/addWiki.d.ts +3 -3
  35. package/build/tools/addWiki.js +16 -2
  36. package/build/tools/countIssues.d.ts +3 -3
  37. package/build/tools/countIssues.js +3 -2
  38. package/build/tools/deleteIssue.d.ts +3 -3
  39. package/build/tools/deleteIssue.js +32 -2
  40. package/build/tools/deleteProject.d.ts +3 -3
  41. package/build/tools/deleteProject.js +22 -2
  42. package/build/tools/deleteVersion.d.ts +3 -3
  43. package/build/tools/deleteVersion.js +12 -2
  44. package/build/tools/deleteWatching.d.ts +3 -3
  45. package/build/tools/deleteWatching.js +12 -2
  46. package/build/tools/getCategories.d.ts +3 -3
  47. package/build/tools/getCategories.js +8 -2
  48. package/build/tools/getCustomFields.d.ts +3 -3
  49. package/build/tools/getCustomFields.js +22 -2
  50. package/build/tools/getDocument.d.ts +3 -3
  51. package/build/tools/getDocument.js +17 -2
  52. package/build/tools/getDocumentTree.d.ts +3 -3
  53. package/build/tools/getDocumentTree.js +7 -2
  54. package/build/tools/getDocuments.d.ts +3 -3
  55. package/build/tools/getDocuments.js +17 -2
  56. package/build/tools/getGitRepositories.d.ts +3 -3
  57. package/build/tools/getGitRepositories.js +17 -2
  58. package/build/tools/getGitRepository.d.ts +3 -3
  59. package/build/tools/getGitRepository.js +17 -2
  60. package/build/tools/getIssue.d.ts +3 -3
  61. package/build/tools/getIssue.js +32 -2
  62. package/build/tools/getIssueComments.d.ts +3 -3
  63. package/build/tools/getIssueComments.js +14 -2
  64. package/build/tools/getIssueTypes.d.ts +3 -3
  65. package/build/tools/getIssueTypes.js +11 -2
  66. package/build/tools/getIssues.d.ts +17 -17
  67. package/build/tools/getIssues.js +32 -2
  68. package/build/tools/getMyself.d.ts +3 -3
  69. package/build/tools/getMyself.js +11 -2
  70. package/build/tools/getNotifications.d.ts +3 -3
  71. package/build/tools/getNotifications.js +15 -2
  72. package/build/tools/getNotificationsCount.d.ts +3 -3
  73. package/build/tools/getNotificationsCount.js +5 -2
  74. package/build/tools/getPriorities.d.ts +3 -3
  75. package/build/tools/getPriorities.js +3 -2
  76. package/build/tools/getProject.d.ts +3 -3
  77. package/build/tools/getProject.js +22 -2
  78. package/build/tools/getProjectList.d.ts +3 -3
  79. package/build/tools/getProjectList.js +22 -2
  80. package/build/tools/getProjectUsers.d.ts +3 -3
  81. package/build/tools/getProjectUsers.js +11 -2
  82. package/build/tools/getPullRequest.d.ts +3 -3
  83. package/build/tools/getPullRequest.js +26 -2
  84. package/build/tools/getPullRequestComments.d.ts +3 -3
  85. package/build/tools/getPullRequestComments.js +12 -2
  86. package/build/tools/getPullRequests.d.ts +3 -3
  87. package/build/tools/getPullRequests.js +26 -2
  88. package/build/tools/getPullRequestsCount.d.ts +3 -3
  89. package/build/tools/getPullRequestsCount.js +5 -2
  90. package/build/tools/getRelatedIssues.d.ts +3 -3
  91. package/build/tools/getRelatedIssues.js +33 -2
  92. package/build/tools/getResolutions.d.ts +3 -3
  93. package/build/tools/getResolutions.js +3 -2
  94. package/build/tools/getSpace.d.ts +3 -3
  95. package/build/tools/getSpace.js +13 -2
  96. package/build/tools/getSpaceActivities.d.ts +3 -3
  97. package/build/tools/getSpaceActivities.js +12 -2
  98. package/build/tools/getUserRecentUpdates.d.ts +3 -3
  99. package/build/tools/getUserRecentUpdates.js +12 -2
  100. package/build/tools/getUserStarsCount.d.ts +3 -3
  101. package/build/tools/getUserStarsCount.js +3 -2
  102. package/build/tools/getUsers.d.ts +3 -3
  103. package/build/tools/getUsers.js +11 -2
  104. package/build/tools/getVersionMilestoneList.d.ts +3 -3
  105. package/build/tools/getVersionMilestoneList.js +12 -2
  106. package/build/tools/getWatchingListCount.d.ts +3 -3
  107. package/build/tools/getWatchingListCount.js +5 -2
  108. package/build/tools/getWatchingListItems.d.ts +3 -3
  109. package/build/tools/getWatchingListItems.js +12 -2
  110. package/build/tools/getWiki.d.ts +3 -3
  111. package/build/tools/getWiki.js +16 -2
  112. package/build/tools/getWikiPages.d.ts +3 -3
  113. package/build/tools/getWikiPages.js +12 -2
  114. package/build/tools/getWikisCount.d.ts +3 -3
  115. package/build/tools/getWikisCount.js +3 -2
  116. package/build/tools/markNotificationAsRead.d.ts +7 -2
  117. package/build/tools/markNotificationAsRead.js +6 -1
  118. package/build/tools/markWatchingAsRead.d.ts +7 -2
  119. package/build/tools/markWatchingAsRead.js +6 -1
  120. package/build/tools/removeRelatedIssue.d.ts +3 -3
  121. package/build/tools/removeRelatedIssue.js +33 -2
  122. package/build/tools/resetUnreadNotificationCount.d.ts +3 -3
  123. package/build/tools/resetUnreadNotificationCount.js +5 -2
  124. package/build/tools/shared/customFieldFiltersSchema.d.ts +1 -1
  125. package/build/tools/updateIssue.d.ts +3 -3
  126. package/build/tools/updateIssue.js +32 -2
  127. package/build/tools/updateIssueComment.d.ts +3 -3
  128. package/build/tools/updateIssueComment.js +14 -2
  129. package/build/tools/updateProject.d.ts +3 -3
  130. package/build/tools/updateProject.js +22 -2
  131. package/build/tools/updatePullRequest.d.ts +3 -3
  132. package/build/tools/updatePullRequest.js +26 -2
  133. package/build/tools/updatePullRequestComment.d.ts +3 -3
  134. package/build/tools/updatePullRequestComment.js +12 -2
  135. package/build/tools/updateVersionMilestone.d.ts +3 -3
  136. package/build/tools/updateVersionMilestone.js +12 -2
  137. package/build/tools/updateWatching.d.ts +3 -3
  138. package/build/tools/updateWatching.js +12 -2
  139. package/build/tools/updateWiki.d.ts +3 -3
  140. package/build/tools/updateWiki.js +16 -2
  141. package/build/types/outputFields.d.ts +26 -0
  142. package/build/types/outputFields.js +3 -0
  143. package/build/types/tool.d.ts +22 -9
  144. package/build/types/zod/activityType.d.ts +38 -0
  145. package/build/types/zod/activityType.js +38 -0
  146. package/build/utils/fieldSelection.d.ts +22 -0
  147. package/build/utils/fieldSelection.js +40 -0
  148. package/build/utils/logger.js +41 -3
  149. package/build/utils/resolveIdOrKey.d.ts +2 -2
  150. package/build/utils/toolsetUtils.d.ts +1 -3
  151. package/build/utils/toolsetUtils.js +0 -12
  152. package/package.json +17 -25
  153. package/build/tools/dynamicTools/toolsets.d.ts +0 -15
  154. package/build/tools/dynamicTools/toolsets.js +0 -103
  155. package/build/types/zod/backlogOutputDefinition.d.ts +0 -3334
  156. package/build/types/zod/backlogOutputDefinition.js +0 -483
  157. package/build/utils/generateFieldsDescription.d.ts +0 -5
  158. package/build/utils/generateFieldsDescription.js +0 -50
  159. package/build/utils/toolRegistrar.d.ts +0 -5
  160. package/build/utils/toolRegistrar.js +0 -12
package/build/index.js CHANGED
@@ -120,11 +120,6 @@ Available toolsets:
120
120
  - git: Tools for managing Git repositories and pull requests
121
121
  - notifications: Tools for managing user notifications`,
122
122
  default: env.get('ENABLE_TOOLSETS').default('all').asArray(','),
123
- })
124
- .option('dynamic-toolsets', {
125
- type: 'boolean',
126
- describe: 'Enable dynamic toolsets such as enable_toolset, list_available_toolsets, etc.',
127
- default: env.get('ENABLE_DYNAMIC_TOOLSETS').default('false').asBool(),
128
123
  })
129
124
  .parseSync();
130
125
  // The alias resolves both spellings to the same argv key, so which one was typed
@@ -134,6 +129,22 @@ Available toolsets:
134
129
  if (hideBin(process.argv).some((arg) => arg.split('=')[0] === '--export-translations')) {
135
130
  process.stderr.write('--export-translations is deprecated and will be removed in a future release. Use --export-descriptions.\n');
136
131
  }
132
+ // Dynamic toolsets are gone. yargs ignores the unknown flag, so without this the
133
+ // server would start with a quietly different tool list: the flag used to drop
134
+ // `all` from the enabled toolsets, so a setup that passed only this one went from
135
+ // no toolsets plus three meta-tools to every toolset enabled.
136
+ //
137
+ // Only worth saying to someone who had it switched on. A setting left at `false`
138
+ // asked for what it now gets, so a notice claiming the tool list changed would be
139
+ // wrong.
140
+ const asksForDynamicToolsets = (value) => value !== undefined &&
141
+ !['', '0', 'false', 'no'].includes(value.toLowerCase());
142
+ const dynamicToolsetsFlag = hideBin(process.argv).find((arg) => arg.split('=')[0] === '--dynamic-toolsets');
143
+ if ((dynamicToolsetsFlag !== undefined &&
144
+ asksForDynamicToolsets(dynamicToolsetsFlag.split('=')[1] ?? 'true')) ||
145
+ asksForDynamicToolsets(process.env.ENABLE_DYNAMIC_TOOLSETS)) {
146
+ process.stderr.write('Dynamic toolsets have been removed, and --dynamic-toolsets / ENABLE_DYNAMIC_TOOLSETS no longer do anything. Every toolset is enabled unless you narrow it with --enable-toolsets or ENABLE_TOOLSETS.\n');
147
+ }
137
148
  const clientRegistry = oauthConfig
138
149
  ? createOAuthBacklogClientRegistry(oauthConfig.backlogDomain)
139
150
  : createBacklogClientRegistry();
@@ -149,20 +160,16 @@ const descriptionOverrides = loadDescriptionOverrides();
149
160
  const descriptionHelper = createDescriptionHelper(descriptionOverrides);
150
161
  const maxTokens = argv.maxTokens;
151
162
  const prefix = argv.prefix;
152
- const enabledToolsets = argv.dynamicToolsets
153
- ? argv.enableToolsets.filter((a) => a !== 'all')
154
- : argv.enableToolsets;
163
+ const enabledToolsets = argv.enableToolsets;
155
164
  const mcpOption = {
156
165
  useFields: useFields,
157
166
  maxTokens,
158
167
  prefix,
159
168
  useOrganization: clientRegistry.isMultiOrganization,
160
169
  };
161
- // Built once and shared by every server the factory produces. `enable_toolset`
162
- // mutates this group, and the stateless HTTP model discards its server after
163
- // each request so a per-server group would lose the enablement immediately.
164
- // Sharing it makes toolset state process-wide, which is the only scope left now
165
- // that the protocol has no sessions.
170
+ // Built once and shared by every server the factory produces. Nothing mutates
171
+ // it, so this is purely to avoid rebuilding the whole tool tree per request under
172
+ // the stateless HTTP model.
166
173
  const sharedToolsetGroup = buildToolsetGroup(backlog, descriptionHelper, enabledToolsets);
167
174
  reportUnknownOverrideKeys({
168
175
  overrides: descriptionOverrides,
@@ -181,7 +188,6 @@ const createServer = () => createBacklogMcpServer({
181
188
  descriptionHelper,
182
189
  enabledToolsets,
183
190
  mcpOption,
184
- dynamicToolsets: argv.dynamicToolsets,
185
191
  toolsetGroup: sharedToolsetGroup,
186
192
  });
187
193
  if (argv.exportDescriptions) {
@@ -196,7 +202,6 @@ if (argv.exportDescriptions) {
196
202
  descriptionHelper,
197
203
  enabledToolsets: ['all'],
198
204
  mcpOption,
199
- dynamicToolsets: true,
200
205
  });
201
206
  const data = descriptionHelper.dump();
202
207
  // eslint-disable-next-line no-console
package/build/lib.d.ts CHANGED
@@ -20,6 +20,6 @@ export { buildToolSchema } from './types/tool.js';
20
20
  export { isErrorLike } from './types/result.js';
21
21
  export type { ComposeOptions } from './handlers/builders/composeToolHandler.js';
22
22
  export type { DescriptionHelper } from './createDescriptionHelper.js';
23
- export type { ToolDefinition, DynamicToolDefinition, ToolRegistrar, } from './types/tool.js';
23
+ export type { ToolDefinition, DynamicToolDefinition } from './types/tool.js';
24
24
  export type { Toolset, ToolsetGroup, DynamicToolset, DynamicToolsetGroup, } from './types/toolsets.js';
25
25
  export type { ErrorLike, SafeResult } from './types/result.js';
@@ -69,8 +69,8 @@ export function loadDescriptionOverrides(options) {
69
69
  continue;
70
70
  if (outcome.status === 'unreadable') {
71
71
  // `logger.error`, not `warn`: the logger runs at level `error` unless
72
- // NODE_ENV says otherwise, so a warning here would never reach the user
73
- // this message exists for.
72
+ // LOG_LEVEL or NODE_ENV says otherwise, so a warning here would never
73
+ // reach the user this message exists for.
74
74
  logger.error({ err: outcome.error, filePath }, 'Could not read the description override file; continuing with the built-in defaults');
75
75
  return {};
76
76
  }
@@ -31,7 +31,6 @@ export function reportUnknownOverrideKeys({ overrides, version, backlog, clientR
31
31
  descriptionHelper: probe,
32
32
  enabledToolsets: ['all'],
33
33
  mcpOption: { ...mcpOption, useOrganization: true },
34
- dynamicToolsets: true,
35
34
  });
36
35
  const known = new Set(Object.keys(probe.dump()));
37
36
  const unknown = configured.filter((key) => !known.has(key));
@@ -1,9 +1,9 @@
1
+ import type { Entity } from 'backlog-js';
1
2
  import { Backlog } from 'backlog-js';
2
3
  import { z } from 'zod';
3
4
  import { DescriptionHelper } from '../createDescriptionHelper.js';
4
- import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
5
5
  import { ToolDefinition } from '../types/tool.js';
6
- declare const addDocumentSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addDocumentSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodNumber;
8
8
  title: z.ZodOptional<z.ZodString>;
9
9
  content: z.ZodOptional<z.ZodString>;
@@ -11,5 +11,5 @@ declare const addDocumentSchema: (t: DescriptionHelper["t"]) => {
11
11
  parentId: z.ZodOptional<z.ZodString>;
12
12
  addLast: z.ZodOptional<z.ZodBoolean>;
13
13
  };
14
- export declare const addDocumentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addDocumentSchema>, (typeof DocumentItemSchema)["shape"]>;
14
+ export declare const addDocumentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addDocumentSchema>, Entity.Document.Document>;
15
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
3
2
  import { buildToolSchema } from '../types/tool.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  const addDocumentSchema = buildToolSchema((t) => ({
5
5
  projectId: z
6
6
  .number()
@@ -28,10 +28,25 @@ const addDocumentSchema = buildToolSchema((t) => ({
28
28
  }));
29
29
  export const addDocumentTool = (backlog, { t }) => {
30
30
  return {
31
- name: 'addDocument',
31
+ name: 'add_document',
32
32
  description: t('TOOL_ADD_DOCUMENT_DESCRIPTION', 'Adds a new document to the specified project.'),
33
33
  schema: z.object(addDocumentSchema(t)),
34
- outputSchema: DocumentItemSchema,
34
+ returnsList: false,
35
+ outputFields: outputFields()([
36
+ 'id',
37
+ 'projectId',
38
+ 'title',
39
+ 'plain',
40
+ 'json',
41
+ 'statusId',
42
+ 'emoji',
43
+ 'attachments',
44
+ 'tags',
45
+ 'createdUser',
46
+ 'created',
47
+ 'updatedUser',
48
+ 'updated',
49
+ ]),
35
50
  importantFields: ['id', 'projectId', 'title', 'plain', 'createdUser'],
36
51
  handler: async (params) => {
37
52
  return backlog.addDocument(params);
@@ -1,9 +1,9 @@
1
+ import type { Entity } from 'backlog-js';
1
2
  import { Backlog } from 'backlog-js';
2
3
  import { z } from 'zod';
3
4
  import { DescriptionHelper } from '../createDescriptionHelper.js';
4
- import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
5
5
  import { ToolDefinition } from '../types/tool.js';
6
- declare const addIssueSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addIssueSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodNumber;
8
8
  summary: z.ZodString;
9
9
  issueTypeId: z.ZodNumber;
@@ -26,5 +26,5 @@ declare const addIssueSchema: (t: DescriptionHelper["t"]) => {
26
26
  otherValue: z.ZodOptional<z.ZodString>;
27
27
  }, z.core.$strip>>>;
28
28
  };
29
- export declare const addIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueSchema>, (typeof IssueSchema)["shape"]>;
29
+ export declare const addIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueSchema>, Entity.Issue.Issue>;
30
30
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
3
2
  import { buildToolSchema } from '../types/tool.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { customFieldsToPayload } from '../backlog/customFields.js';
5
5
  const addIssueSchema = buildToolSchema((t) => ({
6
6
  projectId: z.number().describe(t('TOOL_ADD_ISSUE_PROJECT_ID', 'Project ID')),
@@ -88,7 +88,37 @@ export const addIssueTool = (backlog, { t }) => {
88
88
  name: 'add_issue',
89
89
  description: t('TOOL_ADD_ISSUE_DESCRIPTION', 'Creates a new issue in the specified project.'),
90
90
  schema: z.object(addIssueSchema(t)),
91
- outputSchema: IssueSchema,
91
+ returnsList: false,
92
+ outputFields: outputFields()([
93
+ 'id',
94
+ 'projectId',
95
+ 'issueKey',
96
+ 'keyId',
97
+ 'issueType',
98
+ 'summary',
99
+ 'description',
100
+ 'resolution',
101
+ 'priority',
102
+ 'status',
103
+ 'assignee',
104
+ 'category',
105
+ 'versions',
106
+ 'milestone',
107
+ 'startDate',
108
+ 'dueDate',
109
+ 'estimatedHours',
110
+ 'actualHours',
111
+ 'parentIssueId',
112
+ 'createdUser',
113
+ 'created',
114
+ 'updatedUser',
115
+ 'updated',
116
+ 'customFields',
117
+ 'attachments',
118
+ 'sharedFiles',
119
+ 'stars',
120
+ 'childIssueSummary',
121
+ ]),
92
122
  importantFields: ['summary', 'issueKey', 'description', 'createdUser'],
93
123
  handler: async ({ customFields, ...params }) => {
94
124
  const customFieldPayload = customFieldsToPayload(customFields);
@@ -1,14 +1,14 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addIssueCommentSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addIssueCommentSchema: (t: DescriptionHelper['t']) => {
7
7
  issueId: z.ZodOptional<z.ZodNumber>;
8
8
  issueKey: z.ZodOptional<z.ZodString>;
9
9
  content: z.ZodString;
10
10
  notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
11
11
  attachmentId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
12
12
  };
13
- export declare const addIssueCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueCommentSchema>, (typeof IssueCommentSchema)["shape"]>;
13
+ export declare const addIssueCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueCommentSchema>, Entity.Issue.Comment>;
14
14
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
5
5
  const addIssueCommentSchema = buildToolSchema((t) => ({
6
6
  issueId: z
@@ -28,7 +28,19 @@ export const addIssueCommentTool = (backlog, { t }) => {
28
28
  name: 'add_issue_comment',
29
29
  description: t('TOOL_ADD_ISSUE_COMMENT_DESCRIPTION', 'Adds a comment to an issue'),
30
30
  schema: z.object(addIssueCommentSchema(t)),
31
- outputSchema: IssueCommentSchema,
31
+ returnsList: false,
32
+ outputFields: outputFields()([
33
+ 'id',
34
+ 'projectId',
35
+ 'issueId',
36
+ 'content',
37
+ 'changeLog',
38
+ 'createdUser',
39
+ 'created',
40
+ 'updated',
41
+ 'stars',
42
+ 'notifications',
43
+ ]),
32
44
  handler: async ({ issueId, issueKey, content, notifiedUserId, attachmentId, }) => {
33
45
  const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
34
46
  if (!result.ok) {
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addProjectSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addProjectSchema: (t: DescriptionHelper['t']) => {
7
7
  name: z.ZodString;
8
8
  key: z.ZodString;
9
9
  chartEnabled: z.ZodOptional<z.ZodBoolean>;
@@ -14,5 +14,5 @@ declare const addProjectSchema: (t: DescriptionHelper["t"]) => {
14
14
  markdown: "markdown";
15
15
  }>>;
16
16
  };
17
- export declare const addProjectTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addProjectSchema>, (typeof ProjectSchema)["shape"]>;
17
+ export declare const addProjectTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addProjectSchema>, Entity.Project.Project>;
18
18
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  const addProjectSchema = buildToolSchema((t) => ({
5
5
  name: z.string().describe(t('TOOL_ADD_PROJECT_NAME', 'Project name')),
6
6
  key: z.string().describe(t('TOOL_ADD_PROJECT_KEY', 'Project key')),
@@ -26,7 +26,27 @@ export const addProjectTool = (backlog, { t }) => {
26
26
  name: 'add_project',
27
27
  description: t('TOOL_ADD_PROJECT_DESCRIPTION', 'Creates a new project'),
28
28
  schema: z.object(addProjectSchema(t)),
29
- outputSchema: ProjectSchema,
29
+ returnsList: false,
30
+ outputFields: outputFields()([
31
+ 'id',
32
+ 'projectKey',
33
+ 'name',
34
+ 'chartEnabled',
35
+ 'useResolvedForChart',
36
+ 'subtaskingEnabled',
37
+ 'projectLeaderCanEditProjectLeader',
38
+ 'useWiki',
39
+ 'useFileSharing',
40
+ 'useWikiTreeView',
41
+ 'useOriginalImageSizeAtWiki',
42
+ 'useSubversion',
43
+ 'useGit',
44
+ 'textFormattingRule',
45
+ 'archived',
46
+ 'displayOrder',
47
+ 'useDevAttributes',
48
+ 'grandchildIssueEnabled',
49
+ ]),
30
50
  handler: async ({ name, key, chartEnabled, subtaskingEnabled, projectLeaderCanEditProjectLeader, textFormattingRule, }) => backlog.postProject({
31
51
  name,
32
52
  key,
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addPullRequestSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addPullRequestSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodOptional<z.ZodNumber>;
8
8
  projectKey: z.ZodOptional<z.ZodString>;
9
9
  repoId: z.ZodOptional<z.ZodNumber>;
@@ -16,5 +16,5 @@ declare const addPullRequestSchema: (t: DescriptionHelper["t"]) => {
16
16
  assigneeId: z.ZodOptional<z.ZodNumber>;
17
17
  notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
18
18
  };
19
- export declare const addPullRequestTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestSchema>, (typeof PullRequestSchema)["shape"]>;
19
+ export declare const addPullRequestTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestSchema>, Entity.PullRequest.PullRequest>;
20
20
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
5
5
  const addPullRequestSchema = buildToolSchema((t) => ({
6
6
  projectId: z
@@ -49,7 +49,31 @@ export const addPullRequestTool = (backlog, { t }) => {
49
49
  name: 'add_pull_request',
50
50
  description: t('TOOL_ADD_PULL_REQUEST_DESCRIPTION', 'Creates a new pull request'),
51
51
  schema: z.object(addPullRequestSchema(t)),
52
- outputSchema: PullRequestSchema,
52
+ returnsList: false,
53
+ outputFields: outputFields()([
54
+ 'id',
55
+ 'projectId',
56
+ 'repositoryId',
57
+ 'number',
58
+ 'summary',
59
+ 'description',
60
+ 'base',
61
+ 'branch',
62
+ 'status',
63
+ 'assignee',
64
+ 'issue',
65
+ 'baseCommit',
66
+ 'branchCommit',
67
+ 'mergeCommit',
68
+ 'closeAt',
69
+ 'mergeAt',
70
+ 'createdUser',
71
+ 'created',
72
+ 'updatedUser',
73
+ 'updated',
74
+ 'attachments',
75
+ 'stars',
76
+ ]),
53
77
  handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => {
54
78
  const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
55
79
  if (!result.ok) {
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addPullRequestCommentSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addPullRequestCommentSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodOptional<z.ZodNumber>;
8
8
  projectKey: z.ZodOptional<z.ZodString>;
9
9
  repoId: z.ZodOptional<z.ZodNumber>;
@@ -12,5 +12,5 @@ declare const addPullRequestCommentSchema: (t: DescriptionHelper["t"]) => {
12
12
  content: z.ZodString;
13
13
  notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
14
14
  };
15
- export declare const addPullRequestCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestCommentSchema>, (typeof PullRequestCommentSchema)["shape"]>;
15
+ export declare const addPullRequestCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestCommentSchema>, Entity.PullRequest.Comment>;
16
16
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
5
5
  const addPullRequestCommentSchema = buildToolSchema((t) => ({
6
6
  projectId: z
@@ -35,7 +35,17 @@ export const addPullRequestCommentTool = (backlog, { t }) => {
35
35
  name: 'add_pull_request_comment',
36
36
  description: t('TOOL_ADD_PULL_REQUEST_COMMENT_DESCRIPTION', 'Adds a comment to a pull request'),
37
37
  schema: z.object(addPullRequestCommentSchema(t)),
38
- outputSchema: PullRequestCommentSchema,
38
+ returnsList: false,
39
+ outputFields: outputFields()([
40
+ 'id',
41
+ 'content',
42
+ 'changeLog',
43
+ 'createdUser',
44
+ 'created',
45
+ 'updated',
46
+ 'stars',
47
+ 'notifications',
48
+ ]),
39
49
  importantFields: ['id', 'content', 'createdUser'],
40
50
  handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => {
41
51
  const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { RelatedIssueSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addRelatedIssueSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addRelatedIssueSchema: (t: DescriptionHelper['t']) => {
7
7
  issueId: z.ZodOptional<z.ZodNumber>;
8
8
  issueKey: z.ZodOptional<z.ZodString>;
9
9
  targetIssueId: z.ZodNumber;
10
10
  };
11
- export declare const addRelatedIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addRelatedIssueSchema>, (typeof RelatedIssueSchema)["shape"]>;
11
+ export declare const addRelatedIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addRelatedIssueSchema>, Entity.Issue.RelatedIssue>;
12
12
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { RelatedIssueSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
5
5
  const addRelatedIssueSchema = buildToolSchema((t) => ({
6
6
  issueId: z
@@ -20,7 +20,38 @@ export const addRelatedIssueTool = (backlog, { t }) => {
20
20
  name: 'add_related_issue',
21
21
  description: t('TOOL_ADD_RELATED_ISSUE_DESCRIPTION', 'Relates an issue to another issue'),
22
22
  schema: z.object(addRelatedIssueSchema(t)),
23
- outputSchema: RelatedIssueSchema,
23
+ returnsList: false,
24
+ outputFields: outputFields()([
25
+ 'id',
26
+ 'projectId',
27
+ 'issueKey',
28
+ 'keyId',
29
+ 'issueType',
30
+ 'summary',
31
+ 'description',
32
+ 'resolution',
33
+ 'priority',
34
+ 'status',
35
+ 'assignee',
36
+ 'category',
37
+ 'versions',
38
+ 'milestone',
39
+ 'startDate',
40
+ 'dueDate',
41
+ 'estimatedHours',
42
+ 'actualHours',
43
+ 'parentIssueId',
44
+ 'createdUser',
45
+ 'created',
46
+ 'updatedUser',
47
+ 'updated',
48
+ 'customFields',
49
+ 'attachments',
50
+ 'sharedFiles',
51
+ 'stars',
52
+ 'childIssueSummary',
53
+ 'type',
54
+ ]),
24
55
  handler: async ({ issueId, issueKey, targetIssueId }) => {
25
56
  const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
26
57
  if (!result.ok) {
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addVersionMilestoneSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addVersionMilestoneSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodOptional<z.ZodNumber>;
8
8
  projectKey: z.ZodOptional<z.ZodString>;
9
9
  name: z.ZodString;
@@ -11,5 +11,5 @@ declare const addVersionMilestoneSchema: (t: DescriptionHelper["t"]) => {
11
11
  startDate: z.ZodOptional<z.ZodString>;
12
12
  releaseDueDate: z.ZodOptional<z.ZodString>;
13
13
  };
14
- export declare const addVersionMilestoneTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addVersionMilestoneSchema>, (typeof VersionSchema)["shape"]>;
14
+ export declare const addVersionMilestoneTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addVersionMilestoneSchema>, Entity.Project.Version>;
15
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
5
5
  const addVersionMilestoneSchema = buildToolSchema((t) => ({
6
6
  projectId: z
@@ -32,7 +32,17 @@ export const addVersionMilestoneTool = (backlog, { t }) => {
32
32
  name: 'add_version_milestone',
33
33
  description: t('TOOL_ADD_VERSION_MILESTONE_DESCRIPTION', 'Creates a new version milestone'),
34
34
  schema: z.object(addVersionMilestoneSchema(t)),
35
- outputSchema: VersionSchema,
35
+ returnsList: false,
36
+ outputFields: outputFields()([
37
+ 'id',
38
+ 'projectId',
39
+ 'name',
40
+ 'description',
41
+ 'startDate',
42
+ 'releaseDueDate',
43
+ 'archived',
44
+ 'displayOrder',
45
+ ]),
36
46
  importantFields: [
37
47
  'id',
38
48
  'name',
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addWatchingSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addWatchingSchema: (t: DescriptionHelper['t']) => {
7
7
  issueIdOrKey: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
8
8
  note: z.ZodDefault<z.ZodOptional<z.ZodString>>;
9
9
  };
10
- export declare const addWatchingTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWatchingSchema>, (typeof WatchingListItemSchema)["shape"]>;
10
+ export declare const addWatchingTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWatchingSchema>, Entity.WatchingList.WatchingListItem>;
11
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildToolSchema } from '../types/tool.js';
3
- import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
3
+ import { outputFields } from '../types/outputFields.js';
4
4
  const addWatchingSchema = buildToolSchema((t) => ({
5
5
  issueIdOrKey: z
6
6
  .union([z.number(), z.string()])
@@ -16,7 +16,17 @@ export const addWatchingTool = (backlog, { t }) => {
16
16
  name: 'add_watching',
17
17
  description: t('TOOL_ADD_WATCHING_DESCRIPTION', 'Adds a new watch to an issue'),
18
18
  schema: z.object(addWatchingSchema(t)),
19
- outputSchema: WatchingListItemSchema,
19
+ returnsList: false,
20
+ outputFields: outputFields()([
21
+ 'id',
22
+ 'resourceAlreadyRead',
23
+ 'note',
24
+ 'type',
25
+ 'issue',
26
+ 'lastContentUpdated',
27
+ 'created',
28
+ 'updated',
29
+ ]),
20
30
  handler: async ({ issueIdOrKey, note }) => backlog.postWatchingListItem({
21
31
  issueIdOrKey,
22
32
  note,
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod';
2
+ import type { Entity } from 'backlog-js';
2
3
  import { Backlog } from 'backlog-js';
3
4
  import { ToolDefinition } from '../types/tool.js';
4
5
  import { DescriptionHelper } from '../createDescriptionHelper.js';
5
- import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
6
- declare const addWikiSchema: (t: DescriptionHelper["t"]) => {
6
+ declare const addWikiSchema: (t: DescriptionHelper['t']) => {
7
7
  projectId: z.ZodNumber;
8
8
  name: z.ZodString;
9
9
  content: z.ZodString;
10
10
  mailNotify: z.ZodOptional<z.ZodBoolean>;
11
11
  };
12
- export declare const addWikiTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWikiSchema>, (typeof WikiSchema)["shape"]>;
12
+ export declare const addWikiTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWikiSchema>, Entity.Wiki.Wiki>;
13
13
  export {};