@smartbear/mcp 0.37.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.
@@ -2,7 +2,7 @@ import { appendClientIdentity } from "../../common/info.js";
2
2
  import { ToolError } from "../../common/tools.js";
3
3
  import { applyEdits } from "./patch-spec-utils.js";
4
4
  import { buildSubdomainCandidate, buildPortalName, isConflictError, isOrganizationPortalConflict } from "./portal-utils.js";
5
- import { findTableOfContentsItem, buildPortalLiveUrl, normalizeSlug, isOpenAPI, isAsyncAPI } from "./utils.js";
5
+ import { buildPortalLiveUrl, findTableOfContentsItem, normalizeSlug, isOpenAPI, isAsyncAPI } from "./utils.js";
6
6
  const SWAGGER_URL_REGEX = /\/(apis|domains|templates)\/([^/]+)\/([^/]+)\/([^/]+)/;
7
7
  function hasId(value) {
8
8
  return typeof value === "object" && value !== null && "id" in value;
@@ -391,9 +391,30 @@ class SwaggerAPI {
391
391
  body: JSON.stringify(body)
392
392
  }
393
393
  );
394
- return this.handleResponse(response, {
395
- success: true
396
- });
394
+ const result = await this.handleResponse(
395
+ response,
396
+ {
397
+ success: true
398
+ }
399
+ );
400
+ if (hasId(result) && "slug" in result && "portalId" in result) {
401
+ try {
402
+ const product = result;
403
+ const portalDetails = await this.getPortal(String(product.portalId));
404
+ const url = buildPortalLiveUrl(
405
+ this.config,
406
+ portalDetails,
407
+ product.slug,
408
+ null,
409
+ null,
410
+ false
411
+ );
412
+ return { ...product, url };
413
+ } catch (error) {
414
+ console.warn("Failed to build URL for updated product:", error);
415
+ }
416
+ }
417
+ return result;
397
418
  }
398
419
  /**
399
420
  * Prepare publication metadata and URL for a portal product and page.
@@ -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.suiteId) throw new ToolError("suiteId argument is required");
135
+ if (!args.slug) throw new ToolError("slug argument is required");
129
136
  const response = await this.ftFetch(
130
- `suites/${encodeURIComponent(args.suiteId)}/executions`,
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 suiteId rather than a 404, so this
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 suiteId is correct and belongs to your workspace."
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
- ...data,
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
- return response.json();
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
- return response.json();
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.suiteId) throw new ToolError("suiteId argument is required");
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.suiteId)}/executions/${encodeURIComponent(args.executionId)}/cancel`,
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 suiteId and executionId are correct and belong to your workspace."
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 response.json();
234
+ return renameSuiteIdToSlug(
235
+ await response.json()
236
+ );
217
237
  }
218
238
  async runSuite(args) {
219
- if (!args.suiteId) throw new ToolError("suiteId argument is required");
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.suiteId}/executions`,
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 response.json();
252
+ return renameSuiteIdToSlug(
253
+ await response.json()
254
+ );
233
255
  }
234
256
  async getSuiteExecution(args) {
235
- if (!args.suiteId) throw new ToolError("suiteId argument is required");
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.suiteId}/executions/${args.executionId}`,
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 suiteId 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.",
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 both `suiteId` and the `executionId` arguments returned by `swagger_run_suite`.",
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
- suiteId: z.string().describe("ID of the Functional Testing suite to list executions for").trim().min(1)
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
- suiteId: z.string().describe("ID of the Functional Testing suite the execution belongs to").trim().min(1),
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("Name for the new suite").trim().min(1),
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
- id: z.number().describe("ID of the newly created suite"),
51
- slug: z.string().describe("Slug of the newly created suite"),
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
- suiteId: z.string().describe("ID of the Functional Testing suite to run").trim().min(1),
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
- suiteId: z.string().describe("ID of the Functional Testing suite").trim().min(1),
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({
@@ -285,7 +285,8 @@ const ProductOutputSchema = z.looseObject({
285
285
  portalId: z.string().optional(),
286
286
  description: z.string().optional(),
287
287
  public: z.boolean().optional(),
288
- hidden: z.boolean().optional()
288
+ hidden: z.boolean().optional(),
289
+ url: z.string().optional()
289
290
  });
290
291
  const ProductsListOutputSchema = z.object({
291
292
  page: PageSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbear/mcp",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },