@smartbear/mcp 0.38.0 → 0.39.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.
- package/dist/package.json.js +1 -1
- package/dist/pactflow/client/admin-api.js +491 -0
- package/dist/pactflow/client/ai-api.js +139 -0
- package/dist/pactflow/client/contract-api.js +366 -0
- package/dist/pactflow/client/environment-api.js +156 -0
- package/dist/pactflow/client/http-client.js +47 -0
- package/dist/pactflow/client/pacticipant-api.js +288 -0
- package/dist/pactflow/client/webhook-api.js +113 -0
- package/dist/pactflow/client.js +29 -1967
- package/dist/swagger/client/functional-testing-api.js +39 -17
- package/dist/swagger/client/functional-testing-tools.js +4 -4
- package/dist/swagger/client/functional-testing-types.js +10 -7
- package/package.json +1 -1
|
@@ -2,6 +2,13 @@ import { appendClientIdentity } from "../../common/info.js";
|
|
|
2
2
|
import { ToolError } from "../../common/tools.js";
|
|
3
3
|
const API_HOSTNAME = "api.reflect.run";
|
|
4
4
|
const FUNCTIONAL_TESTING_API_KEY_HEADER = "X-API-KEY";
|
|
5
|
+
function renameSuiteIdToSlug(data) {
|
|
6
|
+
if ("suiteId" in data) {
|
|
7
|
+
const { suiteId, ...rest } = data;
|
|
8
|
+
return { ...rest, slug: suiteId };
|
|
9
|
+
}
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
5
12
|
class FunctionalTestingAPI {
|
|
6
13
|
constructor(getToken, userAgent, baseUrl) {
|
|
7
14
|
this.getToken = getToken;
|
|
@@ -125,9 +132,9 @@ class FunctionalTestingAPI {
|
|
|
125
132
|
return data;
|
|
126
133
|
}
|
|
127
134
|
async listSuiteExecutions(args) {
|
|
128
|
-
if (!args.
|
|
135
|
+
if (!args.slug) throw new ToolError("slug argument is required");
|
|
129
136
|
const response = await this.ftFetch(
|
|
130
|
-
`suites/${encodeURIComponent(args.
|
|
137
|
+
`suites/${encodeURIComponent(args.slug)}/executions`,
|
|
131
138
|
{
|
|
132
139
|
method: "GET",
|
|
133
140
|
headers: this.getFtHeaders()
|
|
@@ -135,12 +142,12 @@ class FunctionalTestingAPI {
|
|
|
135
142
|
handleStatus(
|
|
136
143
|
/* @__PURE__ */ new Map([
|
|
137
144
|
// Defensive: the Reflect API currently returns 200 with an empty
|
|
138
|
-
// `executions.data` list for an unknown
|
|
145
|
+
// `executions.data` list for an unknown slug rather than a 404, so this
|
|
139
146
|
// branch is not expected to fire today. Kept in case the API starts
|
|
140
147
|
// returning 404 for missing suites.
|
|
141
148
|
[
|
|
142
149
|
404,
|
|
143
|
-
"Test suite not found. Verify the
|
|
150
|
+
"Test suite not found. Verify the slug is correct and belongs to your workspace."
|
|
144
151
|
]
|
|
145
152
|
]),
|
|
146
153
|
errorMessageFor("list suite executions")
|
|
@@ -148,7 +155,7 @@ class FunctionalTestingAPI {
|
|
|
148
155
|
);
|
|
149
156
|
const data = await response.json();
|
|
150
157
|
return {
|
|
151
|
-
|
|
158
|
+
slug: args.slug,
|
|
152
159
|
executions: {
|
|
153
160
|
data: data.executions.data.map(
|
|
154
161
|
({ executionId, status, isFinished, url }) => ({
|
|
@@ -175,7 +182,11 @@ class FunctionalTestingAPI {
|
|
|
175
182
|
},
|
|
176
183
|
errorMessageFor("create Functional Testing suite")
|
|
177
184
|
);
|
|
178
|
-
|
|
185
|
+
const data = await response.json();
|
|
186
|
+
return {
|
|
187
|
+
slug: data.slug,
|
|
188
|
+
url: data.url
|
|
189
|
+
};
|
|
179
190
|
}
|
|
180
191
|
async listSuites() {
|
|
181
192
|
const response = await this.ftFetch(
|
|
@@ -186,15 +197,22 @@ class FunctionalTestingAPI {
|
|
|
186
197
|
},
|
|
187
198
|
errorMessageFor("list Functional Testing suites")
|
|
188
199
|
);
|
|
189
|
-
|
|
200
|
+
const data = await response.json();
|
|
201
|
+
return {
|
|
202
|
+
suites: data.suites.data.map(({ name, suiteId, created }) => ({
|
|
203
|
+
name,
|
|
204
|
+
slug: suiteId,
|
|
205
|
+
created
|
|
206
|
+
}))
|
|
207
|
+
};
|
|
190
208
|
}
|
|
191
209
|
async cancelSuiteExecution(args) {
|
|
192
|
-
if (!args.
|
|
210
|
+
if (!args.slug) throw new ToolError("slug argument is required");
|
|
193
211
|
if (!args.executionId) {
|
|
194
212
|
throw new ToolError("executionId argument is required");
|
|
195
213
|
}
|
|
196
214
|
const response = await this.ftFetch(
|
|
197
|
-
`suites/${encodeURIComponent(args.
|
|
215
|
+
`suites/${encodeURIComponent(args.slug)}/executions/${encodeURIComponent(args.executionId)}/cancel`,
|
|
198
216
|
{
|
|
199
217
|
method: "PATCH",
|
|
200
218
|
headers: this.getFtHeaders()
|
|
@@ -203,7 +221,7 @@ class FunctionalTestingAPI {
|
|
|
203
221
|
/* @__PURE__ */ new Map([
|
|
204
222
|
[
|
|
205
223
|
404,
|
|
206
|
-
"Suite execution not found. Verify the
|
|
224
|
+
"Suite execution not found. Verify the slug and executionId are correct and belong to your workspace."
|
|
207
225
|
],
|
|
208
226
|
[
|
|
209
227
|
409,
|
|
@@ -213,15 +231,17 @@ class FunctionalTestingAPI {
|
|
|
213
231
|
errorMessageFor("cancel suite execution")
|
|
214
232
|
)
|
|
215
233
|
);
|
|
216
|
-
return
|
|
234
|
+
return renameSuiteIdToSlug(
|
|
235
|
+
await response.json()
|
|
236
|
+
);
|
|
217
237
|
}
|
|
218
238
|
async runSuite(args) {
|
|
219
|
-
if (!args.
|
|
239
|
+
if (!args.slug) throw new ToolError("slug argument is required");
|
|
220
240
|
const body = args.tunnelAgentName ? JSON.stringify({
|
|
221
241
|
overrides: { agent: { name: args.tunnelAgentName } }
|
|
222
242
|
}) : void 0;
|
|
223
243
|
const response = await this.ftFetch(
|
|
224
|
-
`suites/${args.
|
|
244
|
+
`suites/${args.slug}/executions`,
|
|
225
245
|
{
|
|
226
246
|
method: "POST",
|
|
227
247
|
headers: this.getFtHeaders(),
|
|
@@ -229,15 +249,17 @@ class FunctionalTestingAPI {
|
|
|
229
249
|
},
|
|
230
250
|
errorMessageFor("run suite")
|
|
231
251
|
);
|
|
232
|
-
return
|
|
252
|
+
return renameSuiteIdToSlug(
|
|
253
|
+
await response.json()
|
|
254
|
+
);
|
|
233
255
|
}
|
|
234
256
|
async getSuiteExecution(args) {
|
|
235
|
-
if (!args.
|
|
257
|
+
if (!args.slug) throw new ToolError("slug argument is required");
|
|
236
258
|
if (!args.executionId) {
|
|
237
259
|
throw new ToolError("executionId argument is required");
|
|
238
260
|
}
|
|
239
261
|
const response = await this.ftFetch(
|
|
240
|
-
`suites/${args.
|
|
262
|
+
`suites/${args.slug}/executions/${args.executionId}`,
|
|
241
263
|
{
|
|
242
264
|
method: "GET",
|
|
243
265
|
headers: this.getFtHeaders()
|
|
@@ -255,7 +277,7 @@ class FunctionalTestingAPI {
|
|
|
255
277
|
}
|
|
256
278
|
}
|
|
257
279
|
}
|
|
258
|
-
return data;
|
|
280
|
+
return renameSuiteIdToSlug(data);
|
|
259
281
|
}
|
|
260
282
|
async getTestHistory(args) {
|
|
261
283
|
if (!args.testId) throw new ToolError("testId argument is required");
|
|
@@ -59,7 +59,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
|
|
|
59
59
|
{
|
|
60
60
|
title: "Create Suite",
|
|
61
61
|
toolset: "Functional Testing",
|
|
62
|
-
summary: "Creates a new test suite in your Swagger Functional Testing workspace with a specified name and `runApiTests`, one or more required ordered blocks of tests. Use this tool when you need to group existing tests into a suite for collective execution. Within a block, tests run sequentially by default — set `parallel: true` on a block to run its tests in parallel instead. Blocks themselves always run one after another. Set `maxRetryAttempts` (0-3) on a block to automatically retry its failed tests before they count as failed. Optionally accepts `agentName` to save a tunnel agent override for future runs of the suite.",
|
|
62
|
+
summary: "Creates a new test suite in your Swagger Functional Testing workspace with a specified name and `runApiTests`, one or more required ordered blocks of tests. Use this tool when you need to group existing tests into a suite for collective execution. Within a block, tests run sequentially by default — set `parallel: true` on a block to run its tests in parallel instead. Blocks themselves always run one after another. Set `maxRetryAttempts` (0-3) on a block to automatically retry its failed tests before they count as failed. Optionally accepts `agentName` to save a tunnel agent override for future runs of the suite. Returns `slug`, which identifies the suite for other suite tools (e.g. `swagger_run_suite`).",
|
|
63
63
|
inputSchema: CreateFunctionalTestingSuiteParamsSchema,
|
|
64
64
|
outputSchema: CreateFunctionalTestingSuiteResponseSchema,
|
|
65
65
|
handler: "createFunctionalTestingSuite",
|
|
@@ -69,7 +69,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
|
|
|
69
69
|
{
|
|
70
70
|
title: "List Suites",
|
|
71
71
|
toolset: "Functional Testing",
|
|
72
|
-
summary: "Lists all test suites available in your Swagger Functional Testing workspace. Use this tool when you need to discover available suites before running them or checking their execution history. Do not use this tool to retrieve individual tests or test suite execution results.",
|
|
72
|
+
summary: "Lists all test suites available in your Swagger Functional Testing workspace. Use this tool when you need to discover available suites before running them or checking their execution history. Each suite's `slug` identifies it for other suite tools (e.g. `swagger_run_suite`). Do not use this tool to retrieve individual tests or test suite execution results.",
|
|
73
73
|
handler: "listFunctionalTestingSuites",
|
|
74
74
|
idempotent: true,
|
|
75
75
|
...READ_ONLY
|
|
@@ -77,7 +77,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
|
|
|
77
77
|
{
|
|
78
78
|
title: "Run Suite",
|
|
79
79
|
toolset: "Functional Testing",
|
|
80
|
-
summary: "Runs a specific test suite in your Swagger Functional Testing workspace. The execution is asynchronous — it returns an executionId, not results directly. Use `swagger_get_suite_status` with your
|
|
80
|
+
summary: "Runs a specific test suite in your Swagger Functional Testing workspace. The execution is asynchronous — it returns an executionId, not results directly. Use `swagger_get_suite_status` with your slug and executionId to track progress and retrieve the final per-test results. Optionally accepts a `tunnelAgentName` argument to override the suite's saved tunnel for this run. Do not use this tool to run a single test — use `swagger_run_test` instead.",
|
|
81
81
|
inputSchema: RunFunctionalTestingSuiteParamsSchema,
|
|
82
82
|
handler: "runFunctionalTestingSuite",
|
|
83
83
|
...WRITE,
|
|
@@ -87,7 +87,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
|
|
|
87
87
|
{
|
|
88
88
|
title: "Get Suite Status",
|
|
89
89
|
toolset: "Functional Testing",
|
|
90
|
-
summary: "Get the status of a Swagger Functional Testing suite execution. Returns the overall status (pending, canceled, passed or failed), whether the run is finished, and a per-test breakdown with pass/fail. Use this to poll for the outcome of a suite run triggered by `swagger_run_suite`. Requires
|
|
90
|
+
summary: "Get the status of a Swagger Functional Testing suite execution. Returns the overall status (pending, canceled, passed or failed), whether the run is finished, and a per-test breakdown with pass/fail. Use this to poll for the outcome of a suite run triggered by `swagger_run_suite`. Requires the suite's `slug` and the `executionId` returned by `swagger_run_suite`.",
|
|
91
91
|
inputSchema: GetFunctionalTestingSuiteExecutionSchema,
|
|
92
92
|
handler: "getFunctionalTestingSuiteExecution",
|
|
93
93
|
idempotent: true,
|
|
@@ -6,10 +6,10 @@ const GetFunctionalTestingExecutionTestSchema = z.object({
|
|
|
6
6
|
executionId: z.string().describe("ID of the Functional Testing execution").trim().min(1)
|
|
7
7
|
});
|
|
8
8
|
const ListFunctionalTestingSuiteExecutionsSchema = z.object({
|
|
9
|
-
|
|
9
|
+
slug: z.string().describe("Slug of the Functional Testing suite to list executions for.").trim().min(1)
|
|
10
10
|
});
|
|
11
11
|
const CancelFunctionalTestingSuiteExecutionSchema = z.object({
|
|
12
|
-
|
|
12
|
+
slug: z.string().describe("Slug of the Functional Testing suite the execution belongs to.").trim().min(1),
|
|
13
13
|
executionId: z.string().describe("ID of the Functional Testing suite execution to cancel").trim().min(1)
|
|
14
14
|
});
|
|
15
15
|
const RunApiTestsBlockSchema = z.object({
|
|
@@ -25,7 +25,9 @@ const RunApiTestsBlockSchema = z.object({
|
|
|
25
25
|
)
|
|
26
26
|
});
|
|
27
27
|
const CreateFunctionalTestingSuiteParamsSchema = z.object({
|
|
28
|
-
name: z.string().describe(
|
|
28
|
+
name: z.string().describe(
|
|
29
|
+
"Name for the new suite. Use the name explicitly provided by the user, or if none was given, a descriptive name derived from the purpose or context of the tests being grouped into this suite. This must be a human-readable name, not a numeric ID or test ID."
|
|
30
|
+
).trim().min(1),
|
|
29
31
|
agentName: z.string().trim().min(1).optional().describe(
|
|
30
32
|
"Tunnel agent name to save as this suite's tunnel override for future runs."
|
|
31
33
|
),
|
|
@@ -47,18 +49,19 @@ const CreateFunctionalTestingSuiteParamsSchema = z.object({
|
|
|
47
49
|
});
|
|
48
50
|
});
|
|
49
51
|
const CreateFunctionalTestingSuiteResponseSchema = z.object({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
slug: z.string().describe(
|
|
53
|
+
"Slug of the newly created suite. Use this value as the `slug` argument for other Functional Testing suite tools (e.g. `swagger_run_suite`)."
|
|
54
|
+
),
|
|
52
55
|
url: z.string().describe("Link to the created suite in Swagger Functional Testing UI")
|
|
53
56
|
});
|
|
54
57
|
const RunFunctionalTestingSuiteParamsSchema = z.object({
|
|
55
|
-
|
|
58
|
+
slug: z.string().describe("Slug of the Functional Testing suite to run.").trim().min(1),
|
|
56
59
|
tunnelAgentName: z.string().describe(
|
|
57
60
|
"Optional tunnel agent name to override the suite's saved tunnel for this run. When omitted, the suite's saved tunnel overrides are used, falling back to each test's saved tunnel."
|
|
58
61
|
).trim().min(1).optional()
|
|
59
62
|
});
|
|
60
63
|
const GetFunctionalTestingSuiteExecutionSchema = z.object({
|
|
61
|
-
|
|
64
|
+
slug: z.string().describe("Slug of the Functional Testing suite.").trim().min(1),
|
|
62
65
|
executionId: z.string().describe("ID of the Functional Testing suite execution").trim().min(1)
|
|
63
66
|
});
|
|
64
67
|
const GetFunctionalTestHistoryParamsSchema = z.object({
|