@smartbear/mcp 0.12.1 → 0.13.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 (89) hide show
  1. package/README.md +30 -6
  2. package/dist/bugsnag/client/api/CurrentUser.js +50 -26
  3. package/dist/bugsnag/client/api/Error.js +156 -93
  4. package/dist/bugsnag/client/api/Project.js +398 -276
  5. package/dist/bugsnag/client/api/api.js +4087 -3837
  6. package/dist/bugsnag/client/api/base.js +155 -173
  7. package/dist/bugsnag/client/api/configuration.js +28 -25
  8. package/dist/bugsnag/client/filters.js +11 -20
  9. package/dist/bugsnag/client.js +1398 -1281
  10. package/dist/bugsnag/input-schemas.js +39 -57
  11. package/dist/collaborator/client.js +335 -371
  12. package/dist/common/bugsnag.js +5 -3
  13. package/dist/common/cache.js +50 -57
  14. package/dist/common/client-registry.js +106 -119
  15. package/dist/common/info.js +7 -3
  16. package/dist/common/register-clients.js +0 -16
  17. package/dist/common/server.js +270 -228
  18. package/dist/common/tools.js +19 -0
  19. package/dist/common/transport-http.js +252 -343
  20. package/dist/common/transport-stdio.js +40 -37
  21. package/dist/common/zod-utils.js +20 -0
  22. package/dist/index.js +18 -23
  23. package/dist/package.json.js +11 -0
  24. package/dist/pactflow/client/ai.js +142 -169
  25. package/dist/pactflow/client/base.js +41 -51
  26. package/dist/pactflow/client/prompt-utils.js +93 -84
  27. package/dist/pactflow/client/prompts.js +95 -92
  28. package/dist/pactflow/client/tools.js +94 -83
  29. package/dist/pactflow/client/utils.js +60 -64
  30. package/dist/pactflow/client.js +399 -320
  31. package/dist/qmetry/client/api/client-api.js +43 -41
  32. package/dist/qmetry/client/api/error-handler.js +264 -310
  33. package/dist/qmetry/client/auto-resolve.js +78 -99
  34. package/dist/qmetry/client/automation.js +139 -162
  35. package/dist/qmetry/client/handlers.js +49 -46
  36. package/dist/qmetry/client/issues.js +133 -115
  37. package/dist/qmetry/client/project.js +153 -174
  38. package/dist/qmetry/client/requirement.js +82 -70
  39. package/dist/qmetry/client/testcase.js +240 -208
  40. package/dist/qmetry/client/testsuite.js +332 -293
  41. package/dist/qmetry/client/tools/automation-tools.js +291 -288
  42. package/dist/qmetry/client/tools/index.js +16 -13
  43. package/dist/qmetry/client/tools/issue-tools.js +534 -543
  44. package/dist/qmetry/client/tools/project-tools.js +635 -656
  45. package/dist/qmetry/client/tools/requirement-tools.js +525 -528
  46. package/dist/qmetry/client/tools/testcase-tools.js +773 -786
  47. package/dist/qmetry/client/tools/testsuite-tools.js +1069 -1083
  48. package/dist/qmetry/client/utils.js +8 -14
  49. package/dist/qmetry/client.js +111 -109
  50. package/dist/qmetry/config/constants.js +48 -44
  51. package/dist/qmetry/config/rest-endpoints.js +51 -48
  52. package/dist/qmetry/types/automation.js +7 -7
  53. package/dist/qmetry/types/common.js +763 -1049
  54. package/dist/qmetry/types/issues.js +26 -19
  55. package/dist/qmetry/types/project.js +32 -25
  56. package/dist/qmetry/types/requirements.js +26 -21
  57. package/dist/qmetry/types/testcase.js +55 -44
  58. package/dist/qmetry/types/testsuite.js +66 -52
  59. package/dist/reflect/client.js +284 -226
  60. package/dist/swagger/client/api.js +645 -662
  61. package/dist/swagger/client/configuration.js +31 -33
  62. package/dist/swagger/client/portal-types.js +204 -244
  63. package/dist/swagger/client/registry-types.js +62 -96
  64. package/dist/swagger/client/tools.js +148 -158
  65. package/dist/swagger/client/user-management-types.js +11 -22
  66. package/dist/swagger/client.js +143 -135
  67. package/dist/swagger/config-utils.js +10 -16
  68. package/dist/zephyr/client.js +43 -42
  69. package/dist/zephyr/common/api-client.js +35 -30
  70. package/dist/zephyr/common/auth-service.js +16 -13
  71. package/dist/zephyr/common/rest-api-schemas.js +3173 -5146
  72. package/dist/zephyr/tool/environment/get-environments.js +66 -66
  73. package/dist/zephyr/tool/priority/get-priorities.js +41 -41
  74. package/dist/zephyr/tool/project/get-project.js +37 -37
  75. package/dist/zephyr/tool/project/get-projects.js +46 -46
  76. package/dist/zephyr/tool/status/get-statuses.js +47 -47
  77. package/dist/zephyr/tool/test-case/get-test-case.js +37 -37
  78. package/dist/zephyr/tool/test-case/get-test-cases.js +62 -62
  79. package/dist/zephyr/tool/test-cycle/get-test-cycle.js +37 -37
  80. package/dist/zephyr/tool/test-cycle/get-test-cycles.js +70 -70
  81. package/dist/zephyr/tool/test-execution/get-test-execution.js +37 -37
  82. package/dist/zephyr/tool/test-execution/get-test-executions.js +43 -43
  83. package/package.json +5 -5
  84. package/dist/bugsnag/client/api/index.js +0 -6
  85. package/dist/common/types.js +0 -6
  86. package/dist/qmetry/client/tools/types.js +0 -1
  87. package/dist/swagger/client/index.js +0 -6
  88. package/dist/tests/unit/bugsnag/utils/factories.js +0 -86
  89. package/dist/zephyr/tool/zephyr-tool.js +0 -1
@@ -1,377 +1,341 @@
1
1
  import { z } from "zod";
2
2
  const ConfigurationSchema = z.object({
3
- base_url: z.string().url().describe("Collaborator server base URL"),
4
- username: z.string().describe("Collaborator username for authentication"),
5
- login_ticket: z
6
- .string()
7
- .describe("Collaborator login ticket for authentication"),
3
+ base_url: z.url().describe("Collaborator server base URL"),
4
+ username: z.string().describe("Collaborator username for authentication"),
5
+ login_ticket: z.string().describe("Collaborator login ticket for authentication")
8
6
  });
9
- export class CollaboratorClient {
10
- name = "Collaborator";
11
- toolPrefix = "collaborator";
12
- configPrefix = "Collaborator";
13
- config = ConfigurationSchema;
14
- baseUrl;
15
- username;
16
- loginTicket;
17
- async configure(_server, config, _cache) {
18
- this.baseUrl = config.base_url;
19
- this.username = config.username;
20
- this.loginTicket = config.login_ticket;
21
- return true;
7
+ class CollaboratorClient {
8
+ name = "Collaborator";
9
+ toolPrefix = "collaborator";
10
+ configPrefix = "Collaborator";
11
+ config = ConfigurationSchema;
12
+ baseUrl;
13
+ username;
14
+ loginTicket;
15
+ async configure(_server, config, _cache) {
16
+ this.baseUrl = config.base_url;
17
+ this.username = config.username;
18
+ this.loginTicket = config.login_ticket;
19
+ }
20
+ isConfigured() {
21
+ return this.baseUrl !== void 0 && this.username !== void 0 && this.loginTicket !== void 0;
22
+ }
23
+ /**
24
+ * Calls the Collaborator API with the given commands, prepending authentication automatically.
25
+ * @param commands Array of Collaborator API commands (excluding authentication)
26
+ * @returns Raw Collaborator API response
27
+ */
28
+ async call(commands) {
29
+ const url = `${this.baseUrl}/services/json/v1`;
30
+ const body = [
31
+ {
32
+ command: "SessionService.authenticate",
33
+ args: { login: this.username, ticket: this.loginTicket }
34
+ },
35
+ ...commands
36
+ ];
37
+ const response = await fetch(url, {
38
+ method: "POST",
39
+ headers: { "Content-Type": "application/json" },
40
+ body: JSON.stringify(body)
41
+ });
42
+ if (!response.ok) {
43
+ throw new Error(
44
+ `Collaborator API call failed: ${response.status} - ${await response.text()}`
45
+ );
22
46
  }
23
- /**
24
- * Calls the Collaborator API with the given commands, prepending authentication automatically.
25
- * @param commands Array of Collaborator API commands (excluding authentication)
26
- * @returns Raw Collaborator API response
27
- */
28
- async call(commands) {
29
- if (!this.baseUrl || !this.username || !this.loginTicket) {
30
- throw new Error("Collaborator client not configured");
31
- }
32
- const url = `${this.baseUrl}/services/json/v1`;
33
- // Always prepend authentication command automatically
34
- const body = [
35
- {
36
- command: "SessionService.authenticate",
37
- args: { login: this.username, ticket: this.loginTicket },
38
- },
39
- ...commands,
47
+ return await response.json();
48
+ }
49
+ /**
50
+ * Registers the Collaborator API tool with the MCP server. Accepts commands (excluding authentication).
51
+ */
52
+ async registerTools(register, _getInput) {
53
+ register(
54
+ {
55
+ title: "Find Collaborator Review By ID",
56
+ summary: "Finds a review in Collaborator by its review ID.",
57
+ inputSchema: z.object({
58
+ reviewId: z.string().describe("The Collaborator review ID to find.")
59
+ })
60
+ },
61
+ async (args, _extra) => {
62
+ const { reviewId } = args;
63
+ const commands = [
64
+ {
65
+ command: "ReviewService.findReviewById",
66
+ args: { reviewId }
67
+ }
40
68
  ];
41
- const response = await fetch(url, {
42
- method: "POST",
43
- headers: { "Content-Type": "application/json" },
44
- body: JSON.stringify(body),
45
- });
46
- if (!response.ok) {
47
- throw new Error(`Collaborator API call failed: ${response.status} - ${await response.text()}`);
48
- }
49
- return await response.json();
50
- }
51
- /**
52
- * Registers the Collaborator API tool with the MCP server. Accepts commands (excluding authentication).
53
- */
54
- registerTools(register, _getInput) {
55
- // findReviewById tool
56
- register({
57
- title: "Find Collaborator Review By ID",
58
- summary: "Finds a review in Collaborator by its review ID.",
59
- inputSchema: z.object({
60
- reviewId: z.string().describe("The Collaborator review ID to find."),
61
- }),
62
- }, async (args, _extra) => {
63
- const { reviewId } = args;
64
- const commands = [
65
- {
66
- command: "ReviewService.findReviewById",
67
- args: { reviewId },
68
- },
69
- ];
70
- const result = await this.call(commands);
71
- return {
72
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
73
- };
74
- });
75
- // createReview tool
76
- register({
77
- title: "Create Collaborator Review",
78
- summary: "Creates a new review in Collaborator. All parameters are optional.",
79
- inputSchema: z.object({
80
- creator: z
81
- .string()
82
- .optional()
83
- .describe("Collaborator username of the review creator. Optional. Default: currently logged in user."),
84
- title: z
85
- .string()
86
- .optional()
87
- .describe("Title of the review. Optional. Default: null."),
88
- templateName: z
89
- .string()
90
- .optional()
91
- .describe("Review template name. Optional. Default: system default template."),
92
- accessPolicy: z
93
- .string()
94
- .optional()
95
- .describe("Access policy for the review. Optional. Default: ANYONE."),
96
- }),
97
- }, async (args, _extra) => {
98
- const commandArgs = {};
99
- if (args.creator !== undefined)
100
- commandArgs.creator = args.creator;
101
- if (args.title !== undefined)
102
- commandArgs.title = args.title;
103
- if (args.templateName !== undefined)
104
- commandArgs.templateName = args.templateName;
105
- if (args.accessPolicy !== undefined)
106
- commandArgs.accessPolicy = args.accessPolicy;
107
- const commands = [
108
- {
109
- command: "ReviewService.createReview",
110
- args: commandArgs,
111
- },
112
- ];
113
- const result = await this.call(commands);
114
- return {
115
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
116
- };
117
- });
118
- // rejectReview tool
119
- register({
120
- title: "Reject Collaborator Review",
121
- summary: "Rejects a review in Collaborator by its review ID and reason.",
122
- inputSchema: z.object({
123
- reviewId: z
124
- .union([z.string(), z.number()])
125
- .describe("The Collaborator review ID to reject."),
126
- reason: z.string().describe("Reason for rejecting the review."),
127
- }),
128
- }, async (args, _extra) => {
129
- const { reviewId, reason } = args;
130
- const commands = [
131
- {
132
- command: "ReviewService.reject",
133
- args: {
134
- reviewId,
135
- reason,
136
- },
137
- },
138
- ];
139
- const result = await this.call(commands);
140
- return {
141
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
142
- };
143
- });
144
- register({
145
- title: "ReviewService Action",
146
- summary: "Invoke any ReviewService method by name and arguments. For finishReviewPhase and waitOnPhase, provide reviewId (required) and until (optional, defaults to 'ANY').",
147
- inputSchema: z.object({
148
- action: z.enum([
149
- "moveReviewToAnnotatePhase",
150
- "cancel",
151
- "reopen",
152
- "uncancel",
153
- ]),
154
- args: z.record(z.any()),
155
- }),
156
- }, async (params, _extra) => {
157
- const { action, args } = params;
158
- const commands = [{ command: `ReviewService.${action}`, args }];
159
- const result = await this.call(commands);
160
- return {
161
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
162
- };
163
- });
164
- // getReviews tool
165
- register({
166
- title: "Get Collaborator Reviews",
167
- summary: "Retrieves reviews from Collaborator using ReviewService.getReviews. All parameters are optional and only provided ones are sent.",
168
- inputSchema: z.object({
169
- login: z
170
- .string()
171
- .optional()
172
- .describe("Collaborator username to filter reviews."),
173
- role: z
174
- .string()
175
- .optional()
176
- .describe("Role to filter reviews (e.g., AUTHOR)."),
177
- creator: z
178
- .boolean()
179
- .optional()
180
- .describe("Whether to filter by creator."),
181
- reviewPhase: z
182
- .string()
183
- .optional()
184
- .describe("Review phase to filter (e.g., PLANNING)."),
185
- fullInfo: z
186
- .boolean()
187
- .optional()
188
- .describe("Whether to retrieve full review info."),
189
- fromDate: z
190
- .string()
191
- .optional()
192
- .describe('Minimal creation date in format "yyyy-MM-dd"'),
193
- toDate: z
194
- .string()
195
- .optional()
196
- .describe('Maximal creation date in format "yyyy-MM-dd"'),
197
- }),
198
- }, async (args, _extra) => {
199
- const reviewArgs = {};
200
- if (args.login !== undefined)
201
- reviewArgs.login = args.login;
202
- if (args.role !== undefined)
203
- reviewArgs.role = args.role;
204
- if (args.creator !== undefined)
205
- reviewArgs.creator = args.creator;
206
- if (args.reviewPhase !== undefined)
207
- reviewArgs.reviewPhase = args.reviewPhase;
208
- if (args.fullInfo !== undefined)
209
- reviewArgs.fullInfo = args.fullInfo;
210
- if (args.fromDate !== undefined)
211
- reviewArgs.fromDate = args.fromDate;
212
- if (args.toDate !== undefined)
213
- reviewArgs.toDate = args.toDate;
214
- const commands = [
215
- {
216
- command: "ReviewService.getReviews",
217
- args: reviewArgs,
218
- },
219
- ];
220
- const result = await this.call(commands);
221
- return {
222
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
223
- };
224
- });
225
- // createIntegration tool
226
- register({
227
- title: "Create Collaborator Remote System Configuration",
228
- summary: "Creates a remote system configuration in Collaborator (e.g., Bitbucket, GitHub, etc).",
229
- inputSchema: z.object({
230
- token: z
231
- .string()
232
- .describe("Remote system token, e.g., BITBUCKET, GITHUB, etc."),
233
- title: z.string().describe("Remote system title."),
234
- config: z
235
- .string()
236
- .describe("JSON string containing configuration parameters for the remote system."),
237
- reviewTemplateId: z
238
- .string()
239
- .optional()
240
- .describe("Optional review template ID used by this remote system."),
241
- }),
242
- }, async (args, _extra) => {
243
- const { token, title, config, reviewTemplateId } = args;
244
- const commandArgs = { token, title, config };
245
- if (reviewTemplateId)
246
- commandArgs.reviewTemplateId = reviewTemplateId;
247
- const commands = [
248
- {
249
- command: "AdminRemoteSystemService.createIntegration",
250
- args: commandArgs,
251
- },
252
- ];
253
- const result = await this.call(commands);
254
- return {
255
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
256
- };
257
- });
258
- // editIntegration tool
259
- register({
260
- title: "Edit Collaborator Remote System Configuration",
261
- summary: "Edits parameters of an existing remote system configuration in Collaborator. Only title and config are editable after creation.",
262
- inputSchema: z.object({
263
- id: z
264
- .string()
265
- .describe("ID of the remote system Configuration to edit."),
266
- title: z.string().optional().describe("Remote system title."),
267
- config: z
268
- .string()
269
- .optional()
270
- .describe("JSON string containing configuration parameters for the remote system."),
271
- reviewTemplateId: z
272
- .string()
273
- .optional()
274
- .describe("Optional review template ID used by this remote system."),
275
- }),
276
- }, async (args, _extra) => {
277
- const { id, title, config, reviewTemplateId } = args;
278
- const commandArgs = { id };
279
- if (title)
280
- commandArgs.title = title;
281
- if (config)
282
- commandArgs.config = config;
283
- if (reviewTemplateId)
284
- commandArgs.reviewTemplateId = reviewTemplateId;
285
- const commands = [
286
- {
287
- command: "AdminRemoteSystemService.editIntegration",
288
- args: commandArgs,
289
- },
290
- ];
291
- const result = await this.call(commands);
292
- return {
293
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
294
- };
295
- });
296
- // deleteIntegration tool
297
- register({
298
- title: "Delete Collaborator Remote System Configuration",
299
- summary: "Deletes a remote system configuration in Collaborator by its ID.",
300
- inputSchema: z.object({
301
- id: z
302
- .union([z.string(), z.number()])
303
- .describe("ID of the remote system Configuration to delete."),
304
- }),
305
- }, async (args, _extra) => {
306
- const commandArgs = {};
307
- if (args.id !== undefined)
308
- commandArgs.id =
309
- typeof args.id === "string" && !Number.isNaN(Number(args.id))
310
- ? Number(args.id)
311
- : args.id;
312
- const commands = [
313
- {
314
- command: "AdminRemoteSystemService.deleteIntegration",
315
- args: commandArgs,
316
- },
317
- ];
318
- const result = await this.call(commands);
319
- return {
320
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
321
- };
322
- });
323
- register({
324
- title: "Update Collaborator Remote System Configuration Webhook",
325
- summary: "Updates the webhook for a remote system configuration in Collaborator by its ID.",
326
- inputSchema: z.object({
327
- id: z
328
- .union([z.string(), z.number()])
329
- .describe("ID of the remote system Configuration to update the webhook for."),
330
- }),
331
- }, async (args, _extra) => {
332
- const commandArgs = {};
333
- if (args.id !== undefined)
334
- commandArgs.id =
335
- typeof args.id === "string" && !Number.isNaN(Number(args.id))
336
- ? Number(args.id)
337
- : args.id;
338
- const commands = [
339
- {
340
- command: "AdminRemoteSystemService.updateWebhook",
341
- args: commandArgs,
342
- },
343
- ];
344
- const result = await this.call(commands);
345
- return {
346
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
347
- };
348
- });
349
- // Test connection tool
350
- register({
351
- title: "Test Collaborator Remote System Configuration Connection",
352
- summary: "Tests the connection for a remote system configuration in Collaborator by its ID.",
353
- inputSchema: z.object({
354
- id: z
355
- .union([z.string(), z.number()])
356
- .describe("ID of the remote system Configuration to test connection for."),
357
- }),
358
- }, async (args, _extra) => {
359
- const commandArgs = {};
360
- if (args.id !== undefined)
361
- commandArgs.id =
362
- typeof args.id === "string" && !Number.isNaN(Number(args.id))
363
- ? Number(args.id)
364
- : args.id;
365
- const commands = [
366
- {
367
- command: "AdminRemoteSystemService.testConnection",
368
- args: commandArgs,
369
- },
370
- ];
371
- const result = await this.call(commands);
372
- return {
373
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
374
- };
375
- });
376
- }
69
+ const result = await this.call(commands);
70
+ return {
71
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
72
+ };
73
+ }
74
+ );
75
+ register(
76
+ {
77
+ title: "Create Collaborator Review",
78
+ summary: "Creates a new review in Collaborator. All parameters are optional.",
79
+ inputSchema: z.object({
80
+ creator: z.string().optional().describe(
81
+ "Collaborator username of the review creator. Optional. Default: currently logged in user."
82
+ ),
83
+ title: z.string().optional().describe("Title of the review. Optional. Default: null."),
84
+ templateName: z.string().optional().describe(
85
+ "Review template name. Optional. Default: system default template."
86
+ ),
87
+ accessPolicy: z.string().optional().describe(
88
+ "Access policy for the review. Optional. Default: ANYONE."
89
+ )
90
+ })
91
+ },
92
+ async (args, _extra) => {
93
+ const commandArgs = {};
94
+ if (args.creator !== void 0) commandArgs.creator = args.creator;
95
+ if (args.title !== void 0) commandArgs.title = args.title;
96
+ if (args.templateName !== void 0)
97
+ commandArgs.templateName = args.templateName;
98
+ if (args.accessPolicy !== void 0)
99
+ commandArgs.accessPolicy = args.accessPolicy;
100
+ const commands = [
101
+ {
102
+ command: "ReviewService.createReview",
103
+ args: commandArgs
104
+ }
105
+ ];
106
+ const result = await this.call(commands);
107
+ return {
108
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
109
+ };
110
+ }
111
+ );
112
+ register(
113
+ {
114
+ title: "Reject Collaborator Review",
115
+ summary: "Rejects a review in Collaborator by its review ID and reason.",
116
+ inputSchema: z.object({
117
+ reviewId: z.union([z.string(), z.number()]).describe("The Collaborator review ID to reject."),
118
+ reason: z.string().describe("Reason for rejecting the review.")
119
+ })
120
+ },
121
+ async (args, _extra) => {
122
+ const { reviewId, reason } = args;
123
+ const commands = [
124
+ {
125
+ command: "ReviewService.reject",
126
+ args: {
127
+ reviewId,
128
+ reason
129
+ }
130
+ }
131
+ ];
132
+ const result = await this.call(commands);
133
+ return {
134
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
135
+ };
136
+ }
137
+ );
138
+ register(
139
+ {
140
+ title: "ReviewService Action",
141
+ summary: "Invoke any ReviewService method by name and arguments. For finishReviewPhase and waitOnPhase, provide reviewId (required) and until (optional, defaults to 'ANY').",
142
+ inputSchema: z.object({
143
+ action: z.enum([
144
+ "moveReviewToAnnotatePhase",
145
+ "cancel",
146
+ "reopen",
147
+ "uncancel"
148
+ ]),
149
+ args: z.record(z.string(), z.any())
150
+ })
151
+ },
152
+ async (params, _extra) => {
153
+ const { action, args } = params;
154
+ const commands = [{ command: `ReviewService.${action}`, args }];
155
+ const result = await this.call(commands);
156
+ return {
157
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
158
+ };
159
+ }
160
+ );
161
+ register(
162
+ {
163
+ title: "Get Collaborator Reviews",
164
+ summary: "Retrieves reviews from Collaborator using ReviewService.getReviews. All parameters are optional and only provided ones are sent.",
165
+ inputSchema: z.object({
166
+ login: z.string().optional().describe("Collaborator username to filter reviews."),
167
+ role: z.string().optional().describe("Role to filter reviews (e.g., AUTHOR)."),
168
+ creator: z.boolean().optional().describe("Whether to filter by creator."),
169
+ reviewPhase: z.string().optional().describe("Review phase to filter (e.g., PLANNING)."),
170
+ fullInfo: z.boolean().optional().describe("Whether to retrieve full review info."),
171
+ fromDate: z.string().optional().describe('Minimal creation date in format "yyyy-MM-dd"'),
172
+ toDate: z.string().optional().describe('Maximal creation date in format "yyyy-MM-dd"')
173
+ })
174
+ },
175
+ async (args, _extra) => {
176
+ const reviewArgs = {};
177
+ if (args.login !== void 0) reviewArgs.login = args.login;
178
+ if (args.role !== void 0) reviewArgs.role = args.role;
179
+ if (args.creator !== void 0) reviewArgs.creator = args.creator;
180
+ if (args.reviewPhase !== void 0)
181
+ reviewArgs.reviewPhase = args.reviewPhase;
182
+ if (args.fullInfo !== void 0) reviewArgs.fullInfo = args.fullInfo;
183
+ if (args.fromDate !== void 0) reviewArgs.fromDate = args.fromDate;
184
+ if (args.toDate !== void 0) reviewArgs.toDate = args.toDate;
185
+ const commands = [
186
+ {
187
+ command: "ReviewService.getReviews",
188
+ args: reviewArgs
189
+ }
190
+ ];
191
+ const result = await this.call(commands);
192
+ return {
193
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
194
+ };
195
+ }
196
+ );
197
+ register(
198
+ {
199
+ title: "Create Collaborator Remote System Configuration",
200
+ summary: "Creates a remote system configuration in Collaborator (e.g., Bitbucket, GitHub, etc).",
201
+ inputSchema: z.object({
202
+ token: z.string().describe("Remote system token, e.g., BITBUCKET, GITHUB, etc."),
203
+ title: z.string().describe("Remote system title."),
204
+ config: z.string().describe(
205
+ "JSON string containing configuration parameters for the remote system."
206
+ ),
207
+ reviewTemplateId: z.string().optional().describe(
208
+ "Optional review template ID used by this remote system."
209
+ )
210
+ })
211
+ },
212
+ async (args, _extra) => {
213
+ const { token, title, config, reviewTemplateId } = args;
214
+ const commandArgs = { token, title, config };
215
+ if (reviewTemplateId) commandArgs.reviewTemplateId = reviewTemplateId;
216
+ const commands = [
217
+ {
218
+ command: "AdminRemoteSystemService.createIntegration",
219
+ args: commandArgs
220
+ }
221
+ ];
222
+ const result = await this.call(commands);
223
+ return {
224
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
225
+ };
226
+ }
227
+ );
228
+ register(
229
+ {
230
+ title: "Edit Collaborator Remote System Configuration",
231
+ summary: "Edits parameters of an existing remote system configuration in Collaborator. Only title and config are editable after creation.",
232
+ inputSchema: z.object({
233
+ id: z.string().describe("ID of the remote system Configuration to edit."),
234
+ title: z.string().optional().describe("Remote system title."),
235
+ config: z.string().optional().describe(
236
+ "JSON string containing configuration parameters for the remote system."
237
+ ),
238
+ reviewTemplateId: z.string().optional().describe(
239
+ "Optional review template ID used by this remote system."
240
+ )
241
+ })
242
+ },
243
+ async (args, _extra) => {
244
+ const { id, title, config, reviewTemplateId } = args;
245
+ const commandArgs = { id };
246
+ if (title) commandArgs.title = title;
247
+ if (config) commandArgs.config = config;
248
+ if (reviewTemplateId) commandArgs.reviewTemplateId = reviewTemplateId;
249
+ const commands = [
250
+ {
251
+ command: "AdminRemoteSystemService.editIntegration",
252
+ args: commandArgs
253
+ }
254
+ ];
255
+ const result = await this.call(commands);
256
+ return {
257
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
258
+ };
259
+ }
260
+ );
261
+ register(
262
+ {
263
+ title: "Delete Collaborator Remote System Configuration",
264
+ summary: "Deletes a remote system configuration in Collaborator by its ID.",
265
+ inputSchema: z.object({
266
+ id: z.union([z.string(), z.number()]).describe("ID of the remote system Configuration to delete.")
267
+ })
268
+ },
269
+ async (args, _extra) => {
270
+ const commandArgs = {};
271
+ if (args.id !== void 0)
272
+ commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
273
+ const commands = [
274
+ {
275
+ command: "AdminRemoteSystemService.deleteIntegration",
276
+ args: commandArgs
277
+ }
278
+ ];
279
+ const result = await this.call(commands);
280
+ return {
281
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
282
+ };
283
+ }
284
+ );
285
+ register(
286
+ {
287
+ title: "Update Collaborator Remote System Configuration Webhook",
288
+ summary: "Updates the webhook for a remote system configuration in Collaborator by its ID.",
289
+ inputSchema: z.object({
290
+ id: z.union([z.string(), z.number()]).describe(
291
+ "ID of the remote system Configuration to update the webhook for."
292
+ )
293
+ })
294
+ },
295
+ async (args, _extra) => {
296
+ const commandArgs = {};
297
+ if (args.id !== void 0)
298
+ commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
299
+ const commands = [
300
+ {
301
+ command: "AdminRemoteSystemService.updateWebhook",
302
+ args: commandArgs
303
+ }
304
+ ];
305
+ const result = await this.call(commands);
306
+ return {
307
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
308
+ };
309
+ }
310
+ );
311
+ register(
312
+ {
313
+ title: "Test Collaborator Remote System Configuration Connection",
314
+ summary: "Tests the connection for a remote system configuration in Collaborator by its ID.",
315
+ inputSchema: z.object({
316
+ id: z.union([z.string(), z.number()]).describe(
317
+ "ID of the remote system Configuration to test connection for."
318
+ )
319
+ })
320
+ },
321
+ async (args, _extra) => {
322
+ const commandArgs = {};
323
+ if (args.id !== void 0)
324
+ commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
325
+ const commands = [
326
+ {
327
+ command: "AdminRemoteSystemService.testConnection",
328
+ args: commandArgs
329
+ }
330
+ ];
331
+ const result = await this.call(commands);
332
+ return {
333
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
334
+ };
335
+ }
336
+ );
337
+ }
377
338
  }
339
+ export {
340
+ CollaboratorClient
341
+ };