@smartbear/mcp 0.41.3 → 0.43.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 (63) hide show
  1. package/README.md +5 -0
  2. package/dist/bearq/api.js +16 -0
  3. package/dist/bearq/client.js +9 -1
  4. package/dist/bearq/tool/tasks/stop-task.js +6 -3
  5. package/dist/bearq/tool/workflows/get-workflow-run.js +31 -0
  6. package/dist/bearq/tool/workflows/list-workflows.js +28 -0
  7. package/dist/bearq/tool/workflows/run-workflow.js +57 -0
  8. package/dist/bearq/tool/workflows/stop-workflow-run.js +33 -0
  9. package/dist/bugsnag/client.js +1 -0
  10. package/dist/common/analytics.js +341 -0
  11. package/dist/common/initialize.js +1 -0
  12. package/dist/common/jwt.js +83 -0
  13. package/dist/common/register-clients.js +16 -18
  14. package/dist/common/server.js +36 -0
  15. package/dist/common/transport-http.js +48 -7
  16. package/dist/package.json.js +1 -1
  17. package/dist/pactflow/client/admin-api.js +3 -8
  18. package/dist/pactflow/client/ai.js +34 -0
  19. package/dist/pactflow/client/contract-api.js +2 -0
  20. package/dist/pactflow/client/http-client.js +7 -2
  21. package/dist/pactflow/client/pacticipant-api.js +37 -0
  22. package/dist/pactflow/client/pagination.js +1 -1
  23. package/dist/pactflow/client/schemas/admin.js +799 -0
  24. package/dist/pactflow/client/schemas/common.js +201 -0
  25. package/dist/pactflow/client/schemas/contract.js +444 -0
  26. package/dist/pactflow/client/schemas/environment.js +94 -0
  27. package/dist/pactflow/client/schemas/output.js +55 -0
  28. package/dist/pactflow/client/schemas/pacticipant.js +290 -0
  29. package/dist/pactflow/client/schemas/webhook.js +164 -0
  30. package/dist/pactflow/client/tools.js +32 -1
  31. package/dist/pactflow/client/utils.js +1 -1
  32. package/dist/pactflow/client.js +21 -3
  33. package/dist/qmetry/client/ai-agent.js +3 -0
  34. package/dist/qmetry/client/api/error-handler.js +7 -2
  35. package/dist/qmetry/client/auto-resolve.js +5 -0
  36. package/dist/qmetry/client/handlers.js +2 -1
  37. package/dist/qmetry/client/project.js +19 -1
  38. package/dist/qmetry/client/testsuite.js +207 -2
  39. package/dist/qmetry/client/tools/ai-agent-tools.js +13 -0
  40. package/dist/qmetry/client/tools/issue-tools.js +7 -3
  41. package/dist/qmetry/client/tools/project-tools.js +34 -1
  42. package/dist/qmetry/client/tools/testcase-tools.js +43 -296
  43. package/dist/qmetry/client/tools/testsuite-tools.js +49 -19
  44. package/dist/qmetry/client/udf.js +14 -2
  45. package/dist/qmetry/client.js +2 -1
  46. package/dist/qmetry/config/constants.js +1 -0
  47. package/dist/qmetry/config/rest-endpoints.js +2 -1
  48. package/dist/qmetry/types/ai-agent.js +3 -0
  49. package/dist/qmetry/types/common.js +40 -2
  50. package/dist/qmetry/types/udf.js +1 -20
  51. package/dist/qtm4j/client.js +1 -1
  52. package/dist/swagger/client/api.js +5 -1
  53. package/dist/swagger/client/portal-types.js +11 -5
  54. package/dist/swagger/client/registry-types.js +12 -5
  55. package/dist/swagger/client/tools.js +3 -3
  56. package/dist/zephyr/tool/issue-link/get-test-cases.js +1 -1
  57. package/dist/zephyr/tool/issue-link/get-test-cycles.js +1 -1
  58. package/dist/zephyr/tool/issue-link/get-test-executions.js +1 -1
  59. package/dist/zephyr/tool/test-case/update-test-case.js +1 -1
  60. package/dist/zephyr/tool/test-cycle/update-test-cycle.js +1 -1
  61. package/package.json +4 -3
  62. package/plugin/README.md +42 -0
  63. package/dist/pactflow/client/base.js +0 -488
@@ -0,0 +1,94 @@
1
+ import { z } from "zod";
2
+ import { PaginationSchema, EmptyOutputSchema, EnvironmentOutputSchema, EmbeddedReleasedVersionOutputSchema, EmbeddedDeployedVersionOutputSchema, EmbeddedLinkOutputSchema } from "./common.js";
3
+ const EnvironmentsOutputSchema = z.looseObject({
4
+ _embedded: z.looseObject({
5
+ environments: z.array(EnvironmentOutputSchema).optional()
6
+ }).optional(),
7
+ _links: z.looseObject({
8
+ self: EmbeddedLinkOutputSchema.optional(),
9
+ "pb:environments": z.array(EmbeddedLinkOutputSchema).optional()
10
+ }).optional()
11
+ });
12
+ const DeployedVersionsOutputSchema = z.looseObject({
13
+ _embedded: z.looseObject({
14
+ deployedVersions: z.array(EmbeddedDeployedVersionOutputSchema).optional()
15
+ }).optional(),
16
+ _links: z.looseObject({
17
+ self: EmbeddedLinkOutputSchema.optional()
18
+ }).optional()
19
+ });
20
+ const ReleasedVersionsOutputSchema = z.looseObject({
21
+ _embedded: z.looseObject({
22
+ releasedVersions: z.array(EmbeddedReleasedVersionOutputSchema).optional()
23
+ }).optional(),
24
+ _links: z.looseObject({
25
+ self: EmbeddedLinkOutputSchema.optional()
26
+ }).optional()
27
+ });
28
+ const GetEnvironmentSchema = z.object({
29
+ environmentId: z.string().describe("UUID of the environment")
30
+ });
31
+ const RecordDeploymentSchema = z.object({
32
+ pacticipantName: z.string().describe("Name of the pacticipant that was deployed"),
33
+ versionNumber: z.string().describe("Version number that was deployed"),
34
+ environmentId: z.string().describe("UUID of the target environment"),
35
+ applicationInstance: z.string().optional().describe(
36
+ "Identifies a specific instance when multiple instances of the same application are deployed to the same environment (e.g. 'blue', 'green')"
37
+ )
38
+ });
39
+ const GetCurrentlyDeployedSchema = z.object({
40
+ environmentId: z.string().describe("UUID of the environment")
41
+ }).extend(PaginationSchema.shape);
42
+ const RecordReleaseSchema = z.object({
43
+ pacticipantName: z.string().describe("Name of the pacticipant that was released"),
44
+ versionNumber: z.string().describe("Version number that was released"),
45
+ environmentId: z.string().describe("UUID of the target environment")
46
+ });
47
+ const GetCurrentlySupportedSchema = z.object({
48
+ environmentId: z.string().describe("UUID of the environment")
49
+ }).extend(PaginationSchema.shape);
50
+ const GetVersionDeployedSchema = z.object({
51
+ pacticipantName: z.string().describe("Name of the pacticipant"),
52
+ versionNumber: z.string().describe("Version number"),
53
+ environmentId: z.string().describe("UUID of the environment")
54
+ }).extend(PaginationSchema.shape);
55
+ const CreateEnvironmentSchema = z.object({
56
+ name: z.string().min(1).describe("Unique name for the environment (e.g. 'production', 'staging')"),
57
+ production: z.boolean().describe("Whether this is a production environment"),
58
+ displayName: z.string().optional().describe("Human-readable display name"),
59
+ teamUuids: z.array(z.string().uuid()).optional().describe("UUIDs of teams that own this environment")
60
+ });
61
+ const UpdateEnvironmentSchema = z.object({
62
+ environmentId: z.string().describe("UUID of the environment to update"),
63
+ name: z.string().min(1).describe("Unique name for the environment"),
64
+ production: z.boolean().describe("Whether this is a production environment"),
65
+ displayName: z.string().optional().describe("Human-readable display name"),
66
+ teamUuids: z.array(z.string().uuid()).optional().describe("UUIDs of teams that own this environment")
67
+ });
68
+ const ENVIRONMENT_OUTPUT_SCHEMAS = {
69
+ listEnvironments: EnvironmentsOutputSchema,
70
+ getEnvironment: EnvironmentOutputSchema,
71
+ recordDeployment: EmbeddedDeployedVersionOutputSchema,
72
+ getCurrentlyDeployed: DeployedVersionsOutputSchema,
73
+ recordRelease: EmbeddedReleasedVersionOutputSchema,
74
+ getCurrentlySupported: ReleasedVersionsOutputSchema,
75
+ getDeployedVersions: DeployedVersionsOutputSchema,
76
+ getReleasedVersions: ReleasedVersionsOutputSchema,
77
+ createEnvironment: EnvironmentOutputSchema,
78
+ updateEnvironment: EnvironmentOutputSchema,
79
+ deleteEnvironment: EmptyOutputSchema
80
+ };
81
+ export {
82
+ CreateEnvironmentSchema,
83
+ DeployedVersionsOutputSchema,
84
+ ENVIRONMENT_OUTPUT_SCHEMAS,
85
+ EnvironmentsOutputSchema,
86
+ GetCurrentlyDeployedSchema,
87
+ GetCurrentlySupportedSchema,
88
+ GetEnvironmentSchema,
89
+ GetVersionDeployedSchema,
90
+ RecordDeploymentSchema,
91
+ RecordReleaseSchema,
92
+ ReleasedVersionsOutputSchema,
93
+ UpdateEnvironmentSchema
94
+ };
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import Bugsnag from "../../../common/bugsnag.js";
3
+ import { AI_OUTPUT_SCHEMAS } from "../ai.js";
4
+ import { ADMIN_OUTPUT_SCHEMAS } from "./admin.js";
5
+ import { PaginationOutputSchema } from "./common.js";
6
+ import { CONTRACT_OUTPUT_SCHEMAS } from "./contract.js";
7
+ import { ENVIRONMENT_OUTPUT_SCHEMAS } from "./environment.js";
8
+ import { PACTICIPANT_OUTPUT_SCHEMAS } from "./pacticipant.js";
9
+ import { WEBHOOK_OUTPUT_SCHEMAS } from "./webhook.js";
10
+ const asRoot = (schema) => schema instanceof z.ZodObject ? schema.extend({}) : schema;
11
+ const PACTFLOW_OUTPUT_SCHEMAS = Object.fromEntries(
12
+ Object.entries({
13
+ ...ADMIN_OUTPUT_SCHEMAS,
14
+ ...CONTRACT_OUTPUT_SCHEMAS,
15
+ ...ENVIRONMENT_OUTPUT_SCHEMAS,
16
+ ...PACTICIPANT_OUTPUT_SCHEMAS,
17
+ ...WEBHOOK_OUTPUT_SCHEMAS,
18
+ ...AI_OUTPUT_SCHEMAS
19
+ }).map(([handler, schema]) => [handler, asRoot(schema)])
20
+ );
21
+ function withPaginationOutput(schema) {
22
+ return schema instanceof z.ZodObject ? schema.extend({ pagination: PaginationOutputSchema.optional() }) : schema;
23
+ }
24
+ const reportedTools = /* @__PURE__ */ new Set();
25
+ function describeIssues(issues) {
26
+ return issues.slice(0, 5).map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ").slice(0, 1e3);
27
+ }
28
+ function advisoryOutputSchema(schema, toolName) {
29
+ const standard = schema["~standard"];
30
+ const advisory = {
31
+ ...standard,
32
+ validate: async (value) => {
33
+ const result = await standard.validate(value);
34
+ if (!result.issues?.length) return result;
35
+ if (!reportedTools.has(toolName)) {
36
+ reportedTools.add(toolName);
37
+ const message = `Response of ${toolName} does not match its output schema: ${describeIssues(result.issues)}`;
38
+ console.error(`[PactFlow] ${message}`);
39
+ Bugsnag.notify(new Error(message), (event) => {
40
+ event.severity = "warning";
41
+ event.addMetadata("app", { tool: toolName });
42
+ });
43
+ }
44
+ return { value };
45
+ }
46
+ };
47
+ return new Proxy(schema, {
48
+ get: (target, property) => property === "~standard" ? advisory : Reflect.get(target, property)
49
+ });
50
+ }
51
+ export {
52
+ PACTFLOW_OUTPUT_SCHEMAS,
53
+ advisoryOutputSchema,
54
+ withPaginationOutput
55
+ };
@@ -0,0 +1,290 @@
1
+ import { z } from "zod";
2
+ import { PaginationSchema, EmptyOutputSchema, named, EmbeddedLinkOutputSchema, EmbeddedTeamOutputSchema, EmbeddedNamedOutputSchema, PageOutputSchema, PacticipantVersionWithoutLinksOutputSchema } from "./common.js";
3
+ const PacticipantOutputSchema = named(
4
+ "Pacticipant",
5
+ z.looseObject({
6
+ createdAt: z.string().optional(),
7
+ displayName: z.string().optional(),
8
+ mainBranch: z.string().optional(),
9
+ name: z.string().optional(),
10
+ repositoryName: z.string().optional(),
11
+ repositoryNamespace: z.string().optional(),
12
+ repositoryUrl: z.string().optional(),
13
+ updatedAt: z.string().optional(),
14
+ title: z.string().optional(),
15
+ _embedded: z.looseObject({
16
+ "latest-version": z.looseObject({
17
+ number: z.string().optional(),
18
+ title: z.string().optional(),
19
+ name: z.string().optional()
20
+ }).describe("Use latestVersion").optional(),
21
+ labels: z.array(EmbeddedNamedOutputSchema).optional(),
22
+ latestVersion: z.looseObject({
23
+ number: z.string().optional(),
24
+ _links: z.looseObject({
25
+ self: EmbeddedLinkOutputSchema.optional()
26
+ }).optional()
27
+ }).optional(),
28
+ teams: z.array(EmbeddedTeamOutputSchema).describe(
29
+ "The teams this pacticipant belongs to. Always embedded on the single pacticipant endpoint, and on the collection endpoint when requested via ?include=teams."
30
+ ).optional()
31
+ }).optional(),
32
+ _links: z.looseObject({
33
+ "pb:branch-version": EmbeddedLinkOutputSchema.optional(),
34
+ "pb:branches": EmbeddedLinkOutputSchema.optional(),
35
+ "pb:can-i-deploy-badge": EmbeddedLinkOutputSchema.optional(),
36
+ "pb:can-i-deploy-branch-to-environment-badge": EmbeddedLinkOutputSchema.optional(),
37
+ "pb:label": EmbeddedLinkOutputSchema.optional(),
38
+ "pb:teams": z.array(EmbeddedLinkOutputSchema).describe(
39
+ "Links to the admin team resource for each team this pacticipant belongs to. Present whenever the teams are embedded."
40
+ ).optional(),
41
+ "pb:version": EmbeddedLinkOutputSchema.optional(),
42
+ "pb:version-tag": EmbeddedLinkOutputSchema.optional(),
43
+ "pb:versions": EmbeddedLinkOutputSchema.optional(),
44
+ curies: z.array(EmbeddedLinkOutputSchema).optional(),
45
+ self: EmbeddedLinkOutputSchema.optional(),
46
+ versions: EmbeddedLinkOutputSchema.optional()
47
+ }).optional()
48
+ })
49
+ );
50
+ const PacticipantsOutputSchema = z.looseObject({
51
+ page: PageOutputSchema.optional(),
52
+ pacticipants: z.array(PacticipantOutputSchema).optional(),
53
+ _embedded: z.looseObject({
54
+ pacticipants: z.array(PacticipantOutputSchema).optional()
55
+ }).optional(),
56
+ _links: z.looseObject({
57
+ self: EmbeddedLinkOutputSchema.optional(),
58
+ next: EmbeddedLinkOutputSchema.optional(),
59
+ previous: EmbeddedLinkOutputSchema.optional(),
60
+ "pb:pacticipants-with-label": EmbeddedLinkOutputSchema.optional(),
61
+ "pb:pacticipants": z.array(EmbeddedLinkOutputSchema).optional(),
62
+ pacticipants: z.array(EmbeddedLinkOutputSchema).optional()
63
+ }).optional()
64
+ });
65
+ const BranchOutputSchema = named(
66
+ "Branch",
67
+ z.looseObject({
68
+ name: z.string().optional(),
69
+ createdAt: z.string().optional(),
70
+ _links: z.looseObject({
71
+ self: EmbeddedLinkOutputSchema.optional(),
72
+ "pb:latest-version": EmbeddedLinkOutputSchema.optional()
73
+ }).optional()
74
+ })
75
+ );
76
+ const BranchesOutputSchema = z.looseObject({
77
+ page: PageOutputSchema.optional(),
78
+ _embedded: z.looseObject({
79
+ branches: z.array(BranchOutputSchema).optional()
80
+ }).optional(),
81
+ _links: z.looseObject({
82
+ self: EmbeddedLinkOutputSchema.optional(),
83
+ "pb:branches": z.array(EmbeddedLinkOutputSchema).optional(),
84
+ next: EmbeddedLinkOutputSchema.optional(),
85
+ previous: EmbeddedLinkOutputSchema.optional()
86
+ }).optional()
87
+ });
88
+ const PacticipantVersionLinks = {
89
+ "pb:latest-verification-results-where-pacticipant-is-consumer": EmbeddedLinkOutputSchema.optional(),
90
+ "pb:pact-versions": z.array(EmbeddedLinkOutputSchema).optional(),
91
+ "pb:pacticipant": EmbeddedLinkOutputSchema.optional(),
92
+ "pb:tag": EmbeddedLinkOutputSchema.optional(),
93
+ curies: z.array(EmbeddedLinkOutputSchema).optional(),
94
+ self: EmbeddedLinkOutputSchema.optional()
95
+ };
96
+ const PacticipantVersionInCollectionOutputSchema = named(
97
+ "PacticipantVersionInCollection",
98
+ PacticipantVersionWithoutLinksOutputSchema.extend({
99
+ _links: z.looseObject(PacticipantVersionLinks).optional()
100
+ })
101
+ );
102
+ const PacticipantVersionsOutputSchema = z.looseObject({
103
+ page: PageOutputSchema.optional(),
104
+ _embedded: z.looseObject({
105
+ versions: z.array(PacticipantVersionInCollectionOutputSchema).optional()
106
+ }).optional(),
107
+ _links: z.looseObject({
108
+ "pb:pacticipant": EmbeddedLinkOutputSchema.optional(),
109
+ "pb:versions": z.array(EmbeddedLinkOutputSchema).optional(),
110
+ next: EmbeddedLinkOutputSchema.optional(),
111
+ pacticipant: EmbeddedLinkOutputSchema.optional(),
112
+ previous: EmbeddedLinkOutputSchema.optional(),
113
+ self: EmbeddedLinkOutputSchema.optional(),
114
+ versions: z.array(EmbeddedLinkOutputSchema).describe("Use pb:versions").optional()
115
+ }).optional()
116
+ });
117
+ const PacticipantVersionOutputSchema = PacticipantVersionWithoutLinksOutputSchema.extend({
118
+ _links: z.looseObject({
119
+ ...PacticipantVersionLinks,
120
+ "pb:record-deployment": z.array(EmbeddedLinkOutputSchema).optional(),
121
+ "pb:record-release": z.array(EmbeddedLinkOutputSchema).optional()
122
+ }).optional()
123
+ });
124
+ const LabelOutputSchema = named(
125
+ "Label",
126
+ z.looseObject({
127
+ name: z.string().optional()
128
+ })
129
+ );
130
+ const LabelsOutputSchema = z.looseObject({
131
+ page: PageOutputSchema.optional(),
132
+ _embedded: z.looseObject({
133
+ labels: z.array(LabelOutputSchema).optional()
134
+ }).optional(),
135
+ _links: z.looseObject({
136
+ self: EmbeddedLinkOutputSchema.optional(),
137
+ next: EmbeddedLinkOutputSchema.optional(),
138
+ previous: EmbeddedLinkOutputSchema.optional()
139
+ }).optional()
140
+ });
141
+ const PacticipantLabelOutputSchema = z.looseObject({
142
+ name: z.string().optional(),
143
+ createdAt: z.string().optional(),
144
+ _links: z.looseObject({
145
+ self: z.looseObject({
146
+ title: z.string().optional(),
147
+ name: z.string().optional(),
148
+ href: z.string().optional()
149
+ }).optional(),
150
+ pacticipant: z.looseObject({
151
+ title: z.string().optional(),
152
+ name: z.string().optional(),
153
+ href: z.string().optional()
154
+ }).optional()
155
+ }).optional()
156
+ });
157
+ const GetPacticipantSchema = z.object({
158
+ pacticipantName: z.string().describe("Name of the pacticipant (application or service)")
159
+ });
160
+ const ListBranchesSchema = z.object({
161
+ pacticipantName: z.string().describe("Name of the pacticipant"),
162
+ q: z.string().optional().describe("Filter branches by name"),
163
+ pageNumber: z.number().default(1).optional().describe("Page number"),
164
+ pageSize: z.number().default(5).optional().describe("Results per page")
165
+ });
166
+ const ListVersionsSchema = z.object({
167
+ pacticipantName: z.string().describe("Name of the pacticipant"),
168
+ pageNumber: z.number().default(1).optional().describe("Page number"),
169
+ pageSize: z.number().default(5).optional().describe("Results per page")
170
+ });
171
+ const ListDeployedOrReleasedVersionsSchema = z.object({
172
+ pacticipantName: z.string().describe("Name of the pacticipant"),
173
+ pageNumber: z.number().default(1).optional().describe("Page number"),
174
+ pageSize: z.number().default(5).optional().describe("Results per page")
175
+ });
176
+ const ListEnvironmentVersionsSchema = ListDeployedOrReleasedVersionsSchema.extend({
177
+ environmentId: z.string().describe("UUID of the environment")
178
+ });
179
+ const GetVersionSchema = z.object({
180
+ pacticipantName: z.string().describe("Name of the pacticipant"),
181
+ versionNumber: z.string().describe("Version number to retrieve")
182
+ });
183
+ const GetLatestVersionSchema = z.object({
184
+ pacticipantName: z.string().describe("Name of the pacticipant"),
185
+ tag: z.string().optional().describe(
186
+ "Tag to filter by. If omitted, returns the overall latest version."
187
+ )
188
+ });
189
+ const GetLabelSchema = z.object({
190
+ pacticipantName: z.string().describe("Name of the pacticipant"),
191
+ labelName: z.string().describe("Name of the label")
192
+ });
193
+ const LabelByNameSchema = z.object({
194
+ labelName: z.string().describe("Label name to filter by")
195
+ }).extend(PaginationSchema.shape);
196
+ const UpdatePacticipantSchema = z.object({
197
+ pacticipantName: z.string().describe("Name of the pacticipant to update"),
198
+ displayName: z.string().optional().describe("Human-readable display name"),
199
+ mainBranch: z.string().optional().describe("Name of the main/trunk branch (e.g. 'main')"),
200
+ repositoryName: z.string().optional().describe("Repository name"),
201
+ repositoryNamespace: z.string().optional().describe("Repository namespace/organisation"),
202
+ repositoryUrl: z.string().optional().describe("URL of the source repository")
203
+ });
204
+ const UpdateVersionSchema = z.object({
205
+ pacticipantName: z.string().describe("Name of the pacticipant"),
206
+ versionNumber: z.string().describe("Version number to update"),
207
+ buildUrl: z.string().optional().describe("URL of the CI build that produced this version")
208
+ });
209
+ const GetBranchVersionsSchema = z.object({
210
+ pacticipantName: z.string().describe("Name of the pacticipant"),
211
+ branchName: z.string().describe("Name of the branch"),
212
+ pageNumber: z.number().default(1).optional().describe("Page number"),
213
+ pageSize: z.number().default(5).optional().describe("Results per page")
214
+ });
215
+ const CreatePacticipantSchema = z.object({
216
+ name: z.string().min(1).describe("Name of the pacticipant (cannot be changed after creation)"),
217
+ displayName: z.string().optional().describe("Human-readable display name"),
218
+ mainBranch: z.string().optional().describe("Name of the main/trunk branch (e.g. 'main')"),
219
+ repositoryName: z.string().optional().describe("Repository name"),
220
+ repositoryNamespace: z.string().optional().describe("Repository namespace/organisation"),
221
+ repositoryUrl: z.string().optional().describe("URL of the source repository")
222
+ });
223
+ const DeletePacticipantSchema = z.object({
224
+ pacticipantName: z.string().describe("Name of the pacticipant to delete")
225
+ });
226
+ const GetBranchSchema = z.object({
227
+ pacticipantName: z.string().describe("Name of the pacticipant"),
228
+ branchName: z.string().describe("Name of the branch")
229
+ });
230
+ const DeleteBranchSchema = z.object({
231
+ pacticipantName: z.string().describe("Name of the pacticipant"),
232
+ branchName: z.string().describe("Name of the branch to delete")
233
+ });
234
+ const ManageLabelSchema = z.object({
235
+ pacticipantName: z.string().describe("Name of the pacticipant"),
236
+ labelName: z.string().describe("Name of the label")
237
+ });
238
+ const PACTICIPANT_OUTPUT_SCHEMAS = {
239
+ listPacticipants: PacticipantsOutputSchema,
240
+ getPacticipant: PacticipantOutputSchema,
241
+ listBranches: BranchesOutputSchema,
242
+ listVersions: PacticipantVersionsOutputSchema,
243
+ listDeployedOrReleasedVersions: PacticipantVersionsOutputSchema,
244
+ listEnvironmentVersions: PacticipantVersionsOutputSchema,
245
+ getVersion: PacticipantVersionOutputSchema,
246
+ getLatestVersion: PacticipantVersionOutputSchema,
247
+ listLabels: LabelsOutputSchema,
248
+ getPacticipantLabel: PacticipantLabelOutputSchema,
249
+ listPacticipantsByLabel: PacticipantsOutputSchema,
250
+ updatePacticipant: PacticipantOutputSchema,
251
+ patchPacticipant: PacticipantOutputSchema,
252
+ updateVersion: PacticipantVersionOutputSchema,
253
+ getBranchVersions: PacticipantVersionsOutputSchema,
254
+ createPacticipant: PacticipantOutputSchema,
255
+ getBranch: BranchOutputSchema,
256
+ addLabel: PacticipantLabelOutputSchema,
257
+ deleteBranch: EmptyOutputSchema,
258
+ deletePacticipant: EmptyOutputSchema,
259
+ removeLabel: EmptyOutputSchema
260
+ };
261
+ export {
262
+ BranchOutputSchema,
263
+ BranchesOutputSchema,
264
+ CreatePacticipantSchema,
265
+ DeleteBranchSchema,
266
+ DeletePacticipantSchema,
267
+ GetBranchSchema,
268
+ GetBranchVersionsSchema,
269
+ GetLabelSchema,
270
+ GetLatestVersionSchema,
271
+ GetPacticipantSchema,
272
+ GetVersionSchema,
273
+ LabelByNameSchema,
274
+ LabelOutputSchema,
275
+ LabelsOutputSchema,
276
+ ListBranchesSchema,
277
+ ListDeployedOrReleasedVersionsSchema,
278
+ ListEnvironmentVersionsSchema,
279
+ ListVersionsSchema,
280
+ ManageLabelSchema,
281
+ PACTICIPANT_OUTPUT_SCHEMAS,
282
+ PacticipantLabelOutputSchema,
283
+ PacticipantOutputSchema,
284
+ PacticipantVersionInCollectionOutputSchema,
285
+ PacticipantVersionOutputSchema,
286
+ PacticipantVersionsOutputSchema,
287
+ PacticipantsOutputSchema,
288
+ UpdatePacticipantSchema,
289
+ UpdateVersionSchema
290
+ };
@@ -0,0 +1,164 @@
1
+ import { z } from "zod";
2
+ import { EmptyOutputSchema, EmbeddedLinkOutputSchema, EmbeddedTeamOutputSchema, named } from "./common.js";
3
+ const EmbeddedWebhookOutputSchema = named(
4
+ "EmbeddedWebhook",
5
+ z.looseObject({
6
+ consumerName: z.string().optional(),
7
+ description: z.string().optional(),
8
+ enabled: z.boolean().optional(),
9
+ providerName: z.string().optional(),
10
+ teamUuid: z.string().optional(),
11
+ uuid: z.string().optional(),
12
+ _embedded: z.looseObject({
13
+ team: EmbeddedTeamOutputSchema.optional()
14
+ }).optional(),
15
+ _links: z.looseObject({
16
+ self: EmbeddedLinkOutputSchema.optional()
17
+ }).optional()
18
+ })
19
+ );
20
+ const WebhooksOutputSchema = z.looseObject({
21
+ _embedded: z.looseObject({
22
+ webhooks: z.array(EmbeddedWebhookOutputSchema).optional()
23
+ }).optional(),
24
+ _links: z.looseObject({
25
+ self: EmbeddedLinkOutputSchema.optional(),
26
+ "pb:create": EmbeddedLinkOutputSchema.optional(),
27
+ "pb:webhooks": z.array(EmbeddedLinkOutputSchema).optional(),
28
+ curies: z.array(EmbeddedLinkOutputSchema).optional()
29
+ }).optional()
30
+ });
31
+ const WebhookOutputSchema = z.looseObject({
32
+ consumer: z.looseObject({
33
+ name: z.string().optional()
34
+ }).optional(),
35
+ description: z.string().optional(),
36
+ enabled: z.boolean().optional(),
37
+ events: z.array(
38
+ z.looseObject({
39
+ name: z.string().optional()
40
+ })
41
+ ).optional(),
42
+ provider: z.looseObject({
43
+ name: z.string().optional()
44
+ }).optional(),
45
+ request: z.looseObject({
46
+ body: z.unknown().optional(),
47
+ headers: z.looseObject({}).describe(
48
+ "Request headers. Values support template expressions and auth helper functions."
49
+ ).optional(),
50
+ method: z.string().optional(),
51
+ password: z.string().optional(),
52
+ url: z.string().optional(),
53
+ username: z.string().optional()
54
+ }).optional(),
55
+ teamUuid: z.string().nullable().optional(),
56
+ createdAt: z.string().optional(),
57
+ updatedAt: z.string().optional(),
58
+ uuid: z.string().optional(),
59
+ _embedded: z.looseObject({
60
+ team: EmbeddedTeamOutputSchema.optional()
61
+ }).optional(),
62
+ _links: z.looseObject({
63
+ self: EmbeddedLinkOutputSchema.optional(),
64
+ "pb:execute": EmbeddedLinkOutputSchema.optional(),
65
+ "pb:consumer": EmbeddedLinkOutputSchema.optional(),
66
+ "pb:provider": EmbeddedLinkOutputSchema.optional(),
67
+ "pb:pact-webhooks": EmbeddedLinkOutputSchema.optional(),
68
+ "pb:webhooks": EmbeddedLinkOutputSchema.optional()
69
+ }).optional()
70
+ });
71
+ const UnsavedWebhookExecutionResultOutputSchema = z.looseObject({
72
+ logs: z.string().optional(),
73
+ message: z.string().optional(),
74
+ request: z.looseObject({
75
+ headers: z.looseObject({}).optional(),
76
+ url: z.string().optional(),
77
+ body: z.unknown().optional()
78
+ }).optional(),
79
+ response: z.looseObject({
80
+ headers: z.looseObject({}).optional(),
81
+ status: z.number().optional(),
82
+ body: z.unknown().optional()
83
+ }).optional(),
84
+ success: z.boolean().optional(),
85
+ _links: z.looseObject({
86
+ "try-again": EmbeddedLinkOutputSchema.optional()
87
+ }).optional()
88
+ });
89
+ const WebhookExecutionResultOutputSchema = z.looseObject({
90
+ logs: z.string().optional(),
91
+ message: z.string().optional(),
92
+ request: z.looseObject({
93
+ headers: z.looseObject({}).optional(),
94
+ url: z.string().optional(),
95
+ body: z.unknown().optional()
96
+ }).optional(),
97
+ response: z.looseObject({
98
+ headers: z.looseObject({}).optional(),
99
+ status: z.number().optional(),
100
+ body: z.unknown().optional()
101
+ }).optional(),
102
+ success: z.boolean().optional(),
103
+ _links: z.looseObject({
104
+ "try-again": EmbeddedLinkOutputSchema.optional(),
105
+ webhook: EmbeddedLinkOutputSchema.optional()
106
+ }).optional()
107
+ });
108
+ const WebhookRequestSchema = z.object({
109
+ method: z.literal("POST").describe("HTTP method (must be POST)"),
110
+ url: z.string().url().describe("URL to send the webhook request to"),
111
+ body: z.any().optional().describe("Request body to send"),
112
+ headers: z.record(z.string(), z.string()).optional().describe("HTTP headers to include"),
113
+ username: z.string().optional().describe("Username for basic auth"),
114
+ password: z.string().optional().describe("Password for basic auth")
115
+ });
116
+ const WebhookEventSchema = z.object({
117
+ name: z.string().describe(
118
+ "Event name (e.g. 'contract_content_changed', 'provider_verification_published')"
119
+ )
120
+ });
121
+ const CreateWebhookSchema = z.object({
122
+ description: z.string().describe("Human-readable description of the webhook"),
123
+ events: z.array(WebhookEventSchema).min(1).describe("Events that trigger this webhook"),
124
+ request: WebhookRequestSchema.describe("HTTP request to send when triggered"),
125
+ consumer: z.object({ name: z.string() }).optional().describe("Restrict to a specific consumer (omit for all)"),
126
+ provider: z.object({ name: z.string() }).optional().describe("Restrict to a specific provider (omit for all)"),
127
+ enabled: z.boolean().optional().default(true).describe("Whether the webhook is enabled"),
128
+ teamUuid: z.string().uuid().nullable().optional().describe("UUID of the owning team (null for global)")
129
+ });
130
+ const UpdateWebhookSchema = z.object({
131
+ webhookId: z.string().describe("UUID of the webhook to update"),
132
+ description: z.string().optional().describe("Human-readable description"),
133
+ events: z.array(WebhookEventSchema).optional().describe("Events that trigger this webhook"),
134
+ request: WebhookRequestSchema.optional().describe(
135
+ "HTTP request to send when triggered"
136
+ ),
137
+ consumer: z.object({ name: z.string() }).nullable().optional().describe("Restrict to a specific consumer"),
138
+ provider: z.object({ name: z.string() }).nullable().optional().describe("Restrict to a specific provider"),
139
+ enabled: z.boolean().optional().describe("Whether the webhook is enabled"),
140
+ teamUuid: z.string().uuid().nullable().optional().describe("UUID of the owning team")
141
+ });
142
+ const WebhookIdSchema = z.object({
143
+ webhookId: z.string().describe("UUID of the webhook")
144
+ });
145
+ const WEBHOOK_OUTPUT_SCHEMAS = {
146
+ listWebhooks: WebhooksOutputSchema,
147
+ getWebhook: WebhookOutputSchema,
148
+ createWebhook: WebhookOutputSchema,
149
+ updateWebhook: WebhookOutputSchema,
150
+ executeWebhooks: UnsavedWebhookExecutionResultOutputSchema,
151
+ executeWebhook: WebhookExecutionResultOutputSchema,
152
+ deleteWebhook: EmptyOutputSchema
153
+ };
154
+ export {
155
+ CreateWebhookSchema,
156
+ EmbeddedWebhookOutputSchema,
157
+ UnsavedWebhookExecutionResultOutputSchema,
158
+ UpdateWebhookSchema,
159
+ WEBHOOK_OUTPUT_SCHEMAS,
160
+ WebhookExecutionResultOutputSchema,
161
+ WebhookIdSchema,
162
+ WebhookOutputSchema,
163
+ WebhooksOutputSchema
164
+ };
@@ -1,6 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { GenerationInputSchema, RefineInputSchema } from "./ai.js";
3
- import { CanIDeploySchema, MatrixSchema, GetPacticipantSchema, ListBranchesSchema, ListVersionsSchema, GetVersionSchema, GetLatestVersionSchema, PaginationSchema, GetEnvironmentSchema, RecordDeploymentSchema, GetCurrentlyDeployedSchema, RecordReleaseSchema, GetCurrentlySupportedSchema, PublishConsumerContractsSchema, PublishProviderContractSchema, GetPactsForVerificationSchema, GetBiDirectionalProviderVersionSchema, GetBiDirectionalConsumerProviderVersionSchema, GetPacticipantNetworkSchema, GetLabelSchema, LabelByNameSchema, UpdatePacticipantSchema, UpdateVersionSchema, GetBranchVersionsSchema, GetVersionDeployedSchema, CreateEnvironmentSchema, UpdateEnvironmentSchema, CreatePacticipantSchema, DeletePacticipantSchema, GetBranchSchema, DeleteBranchSchema, ManageLabelSchema, GetIntegrationsByTeamSchema, DeleteIntegrationSchema, WebhookIdSchema, CreateWebhookSchema, UpdateWebhookSchema, SecretIdSchema, CreateSecretSchema, UpdateSecretSchema, RegenerateTokenSchema, AuditSchema, ListAdminUsersSchema, AdminUserIdSchema, CreateAdminUserSchema, UpdateAdminUserSchema, InviteUsersSchema, SetUserRolesSchema, UserRoleSchema, ListAdminTeamsSchema, AdminTeamIdSchema, CreateTeamSchema, UpdateTeamSchema, ListTeamUsersSchema, TeamUserIdSchema, SetTeamUsersSchema, PatchTeamUsersSchema, AdminRoleIdSchema, CreateRoleSchema, UpdateRoleSchema, CreateSystemAccountSchema, GetSystemAccountTokensSchema } from "./base.js";
3
+ import { SecretIdSchema, CreateSecretSchema, UpdateSecretSchema, RegenerateTokenSchema, AuditSchema, ListAdminUsersSchema, AdminUserIdSchema, CreateAdminUserSchema, UpdateAdminUserSchema, InviteUsersSchema, SetUserRolesSchema, UserRoleSchema, ListAdminTeamsSchema, AdminTeamIdSchema, CreateTeamSchema, UpdateTeamSchema, ListTeamUsersSchema, TeamUserIdSchema, SetTeamUsersSchema, PatchTeamUsersSchema, AdminRoleIdSchema, CreateRoleSchema, UpdateRoleSchema, CreateSystemAccountSchema, GetSystemAccountTokensSchema } from "./schemas/admin.js";
4
+ import { PaginationSchema } from "./schemas/common.js";
5
+ import { CanIDeploySchema, MatrixSchema, PublishConsumerContractsSchema, PublishProviderContractSchema, GetPactsForVerificationSchema, GetBiDirectionalProviderVersionSchema, GetBiDirectionalConsumerProviderVersionSchema, GetPacticipantNetworkSchema, GetIntegrationsByTeamSchema, DeleteIntegrationSchema } from "./schemas/contract.js";
6
+ import { GetEnvironmentSchema, RecordDeploymentSchema, GetCurrentlyDeployedSchema, RecordReleaseSchema, GetCurrentlySupportedSchema, GetVersionDeployedSchema, CreateEnvironmentSchema, UpdateEnvironmentSchema } from "./schemas/environment.js";
7
+ import { GetPacticipantSchema, ListBranchesSchema, ListVersionsSchema, ListDeployedOrReleasedVersionsSchema, ListEnvironmentVersionsSchema, GetVersionSchema, GetLatestVersionSchema, GetLabelSchema, LabelByNameSchema, UpdatePacticipantSchema, UpdateVersionSchema, GetBranchVersionsSchema, CreatePacticipantSchema, DeletePacticipantSchema, GetBranchSchema, DeleteBranchSchema, ManageLabelSchema } from "./schemas/pacticipant.js";
8
+ import { WebhookIdSchema, CreateWebhookSchema, UpdateWebhookSchema } from "./schemas/webhook.js";
4
9
  const TOOLS = [
5
10
  {
6
11
  title: "Generate Pact Tests",
@@ -183,6 +188,32 @@ const TOOLS = [
183
188
  openWorld: false,
184
189
  clients: ["pactflow", "pact_broker"]
185
190
  },
191
+ {
192
+ title: "List Deployed or Released Versions",
193
+ toolset: "Environments and Deployments",
194
+ summary: "Retrieve all versions of a pacticipant that have ever been deployed or released.",
195
+ purpose: "List every version of a service that has been deployed or released to any environment. Useful for auditing a service's deployment history and finding versions that reached an environment.",
196
+ inputSchema: ListDeployedOrReleasedVersionsSchema,
197
+ handler: "listDeployedOrReleasedVersions",
198
+ readOnly: true,
199
+ destructive: false,
200
+ idempotent: true,
201
+ openWorld: false,
202
+ clients: ["pactflow"]
203
+ },
204
+ {
205
+ title: "List Environment Versions",
206
+ toolset: "Environments and Deployments",
207
+ summary: "Retrieve the versions of a pacticipant associated with a given environment.",
208
+ purpose: "List the versions of a service that have been deployed or released to a specific environment, identified by its UUID. Use List Environments to find the environment UUID.",
209
+ inputSchema: ListEnvironmentVersionsSchema,
210
+ handler: "listEnvironmentVersions",
211
+ readOnly: true,
212
+ destructive: false,
213
+ idempotent: true,
214
+ openWorld: false,
215
+ clients: ["pactflow"]
216
+ },
186
217
  {
187
218
  title: "Get Pacticipant Version",
188
219
  toolset: "Branches and Versions",
@@ -1,5 +1,4 @@
1
1
  import yaml from "js-yaml";
2
- import Swagger from "swagger-client";
3
2
  import { ToolError } from "../../common/tools.js";
4
3
  import { RemoteOpenAPIDocumentSchema } from "./ai.js";
5
4
  async function resolveOpenAPISpec(remoteOpenAPIDocument) {
@@ -14,6 +13,7 @@ async function resolveOpenAPISpec(remoteOpenAPIDocument) {
14
13
  );
15
14
  }
16
15
  const unresolvedSpec = await getRemoteSpecContents(openAPISchema.data);
16
+ const { default: Swagger } = await import("swagger-client");
17
17
  const resolvedSpec = await Swagger.resolve({ spec: unresolvedSpec });
18
18
  if (resolvedSpec.errors?.length) {
19
19
  throw new ToolError(