@smartbear/mcp 0.33.0 → 0.35.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.
@@ -3,21 +3,29 @@ const SUBDOMAIN_MIN_LENGTH = 3;
3
3
  const SUBDOMAIN_MAX_LENGTH = 20;
4
4
  const PORTAL_NAME_MIN_LENGTH = 3;
5
5
  const PORTAL_NAME_MAX_LENGTH = 40;
6
- function slugify(value, maxLength) {
7
- return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxLength).replace(/-+$/, "");
8
- }
9
- function buildSubdomainCandidate(organizationId, organizationName) {
10
- const fallback = `portal-${organizationId.toLowerCase().replace(/[^a-z0-9]/g, "").slice(0, 8)}`;
11
- if (!organizationName) {
12
- return fallback;
6
+ function convertToValidSubdomain(value = "", rng = Math.random) {
7
+ let converted = value.toLowerCase().replace(/[^a-z0-9-]+/g, "").split("-").filter(Boolean).join("-");
8
+ while (converted.length < SUBDOMAIN_MIN_LENGTH) {
9
+ converted = `${converted}${Math.floor(rng() * 10)}`;
10
+ }
11
+ if (converted.length > SUBDOMAIN_MAX_LENGTH) {
12
+ converted = converted.slice(0, SUBDOMAIN_MAX_LENGTH);
13
+ if (converted.endsWith("-")) {
14
+ converted = converted.slice(0, -1);
15
+ }
13
16
  }
14
- const sanitized = slugify(organizationName, SUBDOMAIN_MAX_LENGTH);
15
- return sanitized.length >= SUBDOMAIN_MIN_LENGTH ? sanitized : fallback;
17
+ return converted;
18
+ }
19
+ function appendRandomSuffix(base, rng = Math.random) {
20
+ const randomChars = `-${rng().toString(36).substring(2, 5).padEnd(3, "0")}`;
21
+ const baseSlug = base.slice(0, SUBDOMAIN_MAX_LENGTH - randomChars.length).replace(/-+$/, "");
22
+ return `${baseSlug}${randomChars}`;
16
23
  }
17
- function buildSuffixedSubdomain(baseSubdomain, organizationId) {
18
- const idSuffix = organizationId.toLowerCase().replace(/[^a-z0-9]/g, "").slice(0, 4);
19
- const trimmedBase = baseSubdomain.slice(0, SUBDOMAIN_MAX_LENGTH - idSuffix.length - 1).replace(/-+$/, "");
20
- return `${trimmedBase}-${idSuffix}`;
24
+ function buildSubdomainCandidate(organizationName, rng = Math.random) {
25
+ return appendRandomSuffix(
26
+ convertToValidSubdomain(organizationName, rng),
27
+ rng
28
+ );
21
29
  }
22
30
  function buildPortalName(organizationName) {
23
31
  const trimmed = organizationName?.trim();
@@ -41,10 +49,10 @@ export {
41
49
  PORTAL_NAME_MIN_LENGTH,
42
50
  SUBDOMAIN_MAX_LENGTH,
43
51
  SUBDOMAIN_MIN_LENGTH,
52
+ appendRandomSuffix,
44
53
  buildPortalName,
45
54
  buildSubdomainCandidate,
46
- buildSuffixedSubdomain,
55
+ convertToValidSubdomain,
47
56
  isConflictError,
48
- isOrganizationPortalConflict,
49
- slugify
57
+ isOrganizationPortalConflict
50
58
  };
@@ -104,7 +104,8 @@ const StandardizeOutputSchema = z.looseObject({
104
104
  message: z.string().optional(),
105
105
  errorsFound: z.number().optional(),
106
106
  fixedDefinition: z.string().optional(),
107
- savedVersion: z.string().optional()
107
+ savedVersion: z.string().optional(),
108
+ url: z.string().optional()
108
109
  });
109
110
  const ApiDefinitionOutputSchema = z.object({
110
111
  definition: z.string()
@@ -5,12 +5,12 @@ const READ_ONLY = {
5
5
  };
6
6
  const WRITE = {
7
7
  readOnly: false,
8
- openWorld: true,
8
+ openWorld: false,
9
9
  destructive: false
10
10
  };
11
11
  const WRITE_DESTRUCTIVE = {
12
12
  readOnly: false,
13
- openWorld: true,
13
+ openWorld: false,
14
14
  destructive: true
15
15
  };
16
16
  export {
@@ -235,16 +235,18 @@ const TOOLS = [
235
235
  inputSchema: CreateApiFromPromptParamsSchema,
236
236
  outputSchema: CreateApiFromPromptOutputSchema,
237
237
  handler: "createApiFromPrompt",
238
- ...WRITE_DESTRUCTIVE
238
+ ...WRITE_DESTRUCTIVE,
239
+ openWorld: true
239
240
  },
240
241
  {
241
242
  title: "Standardize API",
242
243
  toolset: "Registry API",
243
- summary: "Standardize and fix an API definition using AI to ensure compliance with governance policies. Scans the API definition for standardization errors and automatically fixes them using SmartBear AI. Optionally provide 'newVersion' (e.g. patch bump '1.0.0' → '1.0.1') to save the fixed definition as a new version — omitting it will overwrite the current version. Returns the number of errors found and the fixed definition if successful. Use this tool when users ask to standardize, fix, govern, or ensure governance compliance of APIs.",
244
+ summary: "Standardize and fix an API definition using AI to ensure compliance with governance policies. Scans the API definition for standardization errors and automatically fixes them using SmartBear AI. Optionally provide 'newVersion' (e.g. patch bump '1.0.0' → '1.0.1') to save the fixed definition as a new version — omitting it will overwrite the current version. Returns the number of errors found, the fixed definition, and a URL to view the standardized API. Use this tool when users ask to standardize, fix, govern, or ensure governance compliance of APIs.",
244
245
  inputSchema: StandardizeApiParamsSchema,
245
246
  outputSchema: StandardizeOutputSchema,
246
247
  handler: "standardizeApi",
247
- ...WRITE_DESTRUCTIVE
248
+ ...WRITE_DESTRUCTIVE,
249
+ openWorld: true
248
250
  },
249
251
  ...FUNCTIONAL_TESTING_TOOLS
250
252
  ];
@@ -213,6 +213,9 @@ class SwaggerClient {
213
213
  async listFunctionalTestingSuites() {
214
214
  return this.withFunctionalTesting((ftApi) => ftApi.listSuites());
215
215
  }
216
+ async createFunctionalTestingSuite(args) {
217
+ return this.withFunctionalTesting((ftApi) => ftApi.createSuite(args));
218
+ }
216
219
  async getFunctionalTestingTestHistory(args) {
217
220
  return this.withFunctionalTesting((ftApi) => ftApi.getTestHistory(args));
218
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbear/mcp",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "MCP server for interacting SmartBear Products",
5
5
  "keywords": [
6
6
  "smartbear",