@smartbear/mcp 0.41.0 → 0.41.3

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.
@@ -1,4 +1,4 @@
1
- const version = "0.41.0";
1
+ const version = "0.41.3";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -224,7 +224,7 @@ const TOOL_NAMES = {
224
224
  /** Create Test Cycle tool */
225
225
  CREATE_TEST_CYCLE: {
226
226
  TITLE: "Create Test Cycle",
227
- SUMMARY: "Create a new test cycle in a QTM4J project. Supports auto-resolving human-readable names for priority and status. Always creates in the 'MCP Generated' folder. projectId is injected automatically from the active project context."
227
+ SUMMARY: "Create a new test cycle in a QTM4J project. Supports auto-resolving human-readable names for priority and status. projectId is injected automatically from the active project context."
228
228
  },
229
229
  /** Update Test Cycle tool */
230
230
  UPDATE_TEST_CYCLE: {
@@ -411,6 +411,10 @@ const SORT_DEFAULTS = {
411
411
  /** Default sort expression for test cycle search */
412
412
  TEST_CYCLES: "key:asc"
413
413
  };
414
+ const DEFAULT_FOLDER_NAMES = {
415
+ /** Default folder name used when no folderId is supplied by the user */
416
+ MCP_GENERATED: "MCP Generated"
417
+ };
414
418
  const EMPTY_VALUES = {
415
419
  /** Empty object */
416
420
  OBJECT: {},
@@ -426,6 +430,7 @@ export {
426
430
  CLIENT_CONFIG,
427
431
  CONFIG_KEYS,
428
432
  CONTENT_TYPES,
433
+ DEFAULT_FOLDER_NAMES,
429
434
  EMPTY_VALUES,
430
435
  ENDPOINTS,
431
436
  ERROR_MESSAGES,
@@ -19,8 +19,8 @@ const SearchTestCaseFilter = zod.object({
19
19
  components: zod.array(zod.string()).optional().describe(
20
20
  "Component names to include (OR logic within array). Example: ['UI', 'Cloud', 'API']. Use exact component names as configured in the project."
21
21
  ),
22
- folders: zod.array(zod.number()).optional().describe(
23
- "Folder IDs (numeric, OR logic within array). Example: [123, 456]. Retrieve folder IDs from the project's folder structure."
22
+ folderId: zod.number().int().positive().optional().describe(
23
+ "Numeric folder ID to filter test cases by. Right-click the target folder in QTM4J and select 'Copy Folder Id' to get this value."
24
24
  ),
25
25
  assignee: zod.array(zod.string()).optional().describe(
26
26
  "Jira account IDs of assignees (OR logic within array). Example: ['712020:ddc8e24b-2de7-404b-b9ed-3d7b241e2ced']. Multiple IDs match test cases assigned to any of them."
@@ -11,7 +11,9 @@ const TestStepSchema = zod.object({
11
11
  const CreateTestCaseBody = zod.object({
12
12
  summary: zod.string().describe("Test case summary/title"),
13
13
  description: zod.string().optional().describe("Test case description"),
14
- folderId: zod.number().optional().describe("Folder ID to place the test case in"),
14
+ folderId: zod.number().int().positive().optional().describe(
15
+ "Numeric folder ID where the test case will be created. If omitted, the test case is created in the 'MCP Generated' folder automatically."
16
+ ),
15
17
  priority: zod.string().optional().describe(
16
18
  "Priority name (e.g., 'High', 'Medium', 'Low'). Auto-resolved to ID."
17
19
  ),
@@ -10,6 +10,9 @@ const CreateTestCycleBody = zod.object({
10
10
  status: zod.string().optional().describe(
11
11
  "Status name (e.g., 'To Do', 'In Progress', 'Done'). Auto-resolved to ID."
12
12
  ),
13
+ folderId: zod.number().int().positive().optional().describe(
14
+ "Numeric folder ID where the test cycle will be created. If omitted, the cycle is created in the 'MCP Generated' folder automatically."
15
+ ),
13
16
  assignee: zod.string().optional().describe("Assignee account ID"),
14
17
  reporter: zod.string().optional().describe("Reporter account ID"),
15
18
  labels: zod.array(zod.string()).optional().describe(
@@ -1,6 +1,6 @@
1
1
  import { Tool } from "../../../common/tools.js";
2
- import { TOOL_NAMES, TOOLSETS, ENDPOINTS } from "../../config/constants.js";
3
- import { ResolverKeys, InputField } from "../../config/field-resolution.types.js";
2
+ import { TOOL_NAMES, TOOLSETS, DEFAULT_FOLDER_NAMES, ENDPOINTS } from "../../config/constants.js";
3
+ import { InputField, ResolverKeys } from "../../config/field-resolution.types.js";
4
4
  import { CreateTestCaseResponse, CreateTestCaseBody } from "../../schema/test-case.schema.js";
5
5
  const FIELD_CONFIG = {
6
6
  [InputField.PRIORITY]: ResolverKeys.CommonAttribute.PRIORITY,
@@ -82,7 +82,7 @@ class CreateTestCase extends Tool {
82
82
  "If priority or status name is not found, the operation proceeds without that field and a warning is returned.",
83
83
  "Labels and components are resolved on demand. If a name is not found, it is skipped with a warning.",
84
84
  "Steps: ALWAYS include all three fields — stepDetails, testData, and expectedResult. Generate reasonable values if not provided.",
85
- "folderId is optional. assignee and reporter accept Jira account IDs."
85
+ "FOLDER ID: folderId is optional. If omitted, defaults to the 'MCP Generated' folder. To place in a specific folder, ask the user to right-click the target folder in QTM4J and select 'Copy Folder Id' — never try to look it up."
86
86
  ],
87
87
  outputDescription: "JSON object with test case ID, key, version number, and summary. Warnings included if any fields were skipped."
88
88
  };
@@ -90,14 +90,20 @@ class CreateTestCase extends Tool {
90
90
  handle = async (rawArgs) => {
91
91
  const fieldResolver = this.client.getResolverRegistry();
92
92
  const context = fieldResolver.requireProjectContext();
93
+ const parsed = CreateTestCaseBody.parse(rawArgs);
93
94
  const body = {
94
- ...CreateTestCaseBody.parse(rawArgs),
95
- projectId: String(context.projectId),
96
- folderId: "MCP Generated"
95
+ ...parsed,
96
+ projectId: String(context.projectId)
97
97
  };
98
+ const activeFieldConfig = { ...FIELD_CONFIG };
99
+ if (typeof body[InputField.FOLDER] === "number") {
100
+ delete activeFieldConfig[InputField.FOLDER];
101
+ } else {
102
+ body[InputField.FOLDER] = DEFAULT_FOLDER_NAMES.MCP_GENERATED;
103
+ }
98
104
  const warnings = [];
99
105
  await Promise.all(
100
- Object.entries(FIELD_CONFIG).map(
106
+ Object.entries(activeFieldConfig).map(
101
107
  ([inputField, resolverKey]) => fieldResolver.getResolver(resolverKey).resolve(inputField, resolverKey, body, context, warnings)
102
108
  )
103
109
  );
@@ -151,11 +151,11 @@ class GetTestCases extends Tool {
151
151
  description: "Filter by folder and fix version",
152
152
  parameters: {
153
153
  filter: {
154
- folders: [123, 456],
154
+ folderId: 123,
155
155
  fixVersions: [789]
156
156
  }
157
157
  },
158
- expectedOutput: "Test cases in the specified folders and fix versions"
158
+ expectedOutput: "Test cases in the specified folder and fix version"
159
159
  },
160
160
  {
161
161
  description: "Complex filter: multiple criteria combined with multi-field sort",
@@ -1,6 +1,6 @@
1
1
  import { Tool } from "../../../common/tools.js";
2
- import { TOOL_NAMES, TOOLSETS, ENDPOINTS } from "../../config/constants.js";
3
- import { ResolverKeys, InputField } from "../../config/field-resolution.types.js";
2
+ import { TOOL_NAMES, TOOLSETS, DEFAULT_FOLDER_NAMES, ENDPOINTS } from "../../config/constants.js";
3
+ import { InputField, ResolverKeys } from "../../config/field-resolution.types.js";
4
4
  import { CreateTestCycleResponse, CreateTestCycleBody } from "../../schema/test-cycle.schema.js";
5
5
  const FIELD_CONFIG = {
6
6
  [InputField.PRIORITY]: ResolverKeys.CommonAttribute.PRIORITY,
@@ -48,7 +48,7 @@ class CreateTestCycle extends Tool {
48
48
  hints: [
49
49
  "PREREQUISITE: set_project_context must be called before this tool. NEVER auto-select a project.",
50
50
  "If any priority, status, label, or component name cannot be resolved, the cycle is still created but a warning is returned. Suggest the closest available value from the set_project_context response and ask the user to confirm before retrying.",
51
- "All cycles are placed in the 'MCP Generated' folder — do not pass folderId.",
51
+ "FOLDER ID: folderId is optional. If omitted, defaults to the 'MCP Generated' folder. To place in a specific folder, ask the user to right-click the target folder in QTM4J and select 'Copy Folder Id' — never try to look it up.",
52
52
  "Date format: 'dd/MMM/yyyy HH:mm' e.g. '10/May/2026 00:00'. Month must be capitalised. plannedStartDate must be ≤ plannedEndDate."
53
53
  ],
54
54
  outputDescription: "JSON object with the new test cycle's id and key (e.g. 'TRWT-TR-218'). Warnings included if any fields were skipped."
@@ -57,14 +57,20 @@ class CreateTestCycle extends Tool {
57
57
  handle = async (rawArgs) => {
58
58
  const fieldResolver = this.client.getResolverRegistry();
59
59
  const context = fieldResolver.requireProjectContext();
60
+ const parsed = CreateTestCycleBody.parse(rawArgs);
60
61
  const body = {
61
- ...CreateTestCycleBody.parse(rawArgs),
62
- projectId: context.projectId,
63
- folderId: "MCP Generated"
62
+ ...parsed,
63
+ projectId: context.projectId
64
64
  };
65
+ const activeFieldConfig = { ...FIELD_CONFIG };
66
+ if (typeof body[InputField.FOLDER] === "number") {
67
+ delete activeFieldConfig[InputField.FOLDER];
68
+ } else {
69
+ body[InputField.FOLDER] = DEFAULT_FOLDER_NAMES.MCP_GENERATED;
70
+ }
65
71
  const warnings = [];
66
72
  await Promise.all(
67
- Object.entries(FIELD_CONFIG).map(
73
+ Object.entries(activeFieldConfig).map(
68
74
  ([inputField, resolverKey]) => fieldResolver.getResolver(resolverKey).resolve(inputField, resolverKey, body, context, warnings)
69
75
  )
70
76
  );
@@ -1120,6 +1120,84 @@ class SwaggerAPI {
1120
1120
  }
1121
1121
  return results;
1122
1122
  }
1123
+ /**
1124
+ * Validate an API definition using server-side apidom-ls.
1125
+ * Accepts either a raw definition or an existing API identified by owner/apiName/version.
1126
+ * @param params Parameters including definition or registry coordinates
1127
+ * @returns Apidom validation result with findings (line, severity, message)
1128
+ */
1129
+ async validateApi(params) {
1130
+ let definition = params.definition;
1131
+ const coordinates = {
1132
+ owner: params.owner,
1133
+ apiName: params.apiName,
1134
+ version: params.version
1135
+ };
1136
+ const providedCoordinates = Object.keys(coordinates).filter(
1137
+ (key) => coordinates[key]
1138
+ );
1139
+ if (definition && providedCoordinates.length > 0) {
1140
+ throw new ToolError(
1141
+ "Provide either 'definition' or 'owner' + 'apiName' + 'version', not both"
1142
+ );
1143
+ }
1144
+ if (!definition && providedCoordinates.length > 0 && providedCoordinates.length < 3) {
1145
+ const missing = Object.keys(coordinates).filter(
1146
+ (key) => !providedCoordinates.includes(key)
1147
+ );
1148
+ throw new ToolError(
1149
+ `Missing ${missing.map((key) => `'${key}'`).join(", ")} - 'owner', 'apiName' and 'version' are all required to validate an existing API`
1150
+ );
1151
+ }
1152
+ if (!definition && params.owner && params.apiName && params.version) {
1153
+ const fetched = await this.getApiDefinition(
1154
+ {
1155
+ owner: params.owner,
1156
+ api: params.apiName,
1157
+ version: params.version
1158
+ },
1159
+ { accept: "text/plain" }
1160
+ );
1161
+ if (typeof fetched !== "string") {
1162
+ throw new ToolError(
1163
+ `Failed to fetch API definition for ${params.owner}/${params.apiName}/${params.version}`
1164
+ );
1165
+ }
1166
+ definition = fetched;
1167
+ }
1168
+ if (!definition) {
1169
+ throw new ToolError(
1170
+ "Either 'definition' or 'owner' + 'apiName' + 'version' must be provided"
1171
+ );
1172
+ }
1173
+ const searchParams = new URLSearchParams();
1174
+ if (params.maxProblems !== void 0) {
1175
+ searchParams.set("maxProblems", String(params.maxProblems));
1176
+ }
1177
+ if (params.uri) {
1178
+ searchParams.set("uri", params.uri);
1179
+ }
1180
+ const queryString = searchParams.toString();
1181
+ const url = `${this.config.registryBasePath}/specs/validate${queryString ? `?${queryString}` : ""}`;
1182
+ const response = await fetch(url, {
1183
+ method: "POST",
1184
+ headers: {
1185
+ ...this.headers,
1186
+ "Content-Type": "application/json"
1187
+ },
1188
+ body: JSON.stringify({ definition })
1189
+ });
1190
+ if (response.status === 422) {
1191
+ return this.parseResponse(response, {});
1192
+ }
1193
+ if (!response.ok) {
1194
+ const errorText = await response.text().catch(() => "");
1195
+ throw new ToolError(
1196
+ `SwaggerHub Registry API specs/validate failed - status: ${response.status} ${response.statusText}${errorText ? ` - ${errorText}` : ""}`
1197
+ );
1198
+ }
1199
+ return this.handleResponse(response);
1200
+ }
1123
1201
  /**
1124
1202
  * Standardize and fix an API definition using AI
1125
1203
  * @param params Parameters including owner, API name, version, and optional newVersion
@@ -48,6 +48,28 @@ const ScanApiStandardizationFromRegistryParamsSchema = z.object({
48
48
  apiName: z.string().describe("API name (case-sensitive)"),
49
49
  version: z.string().describe("Version identifier")
50
50
  });
51
+ const ValidateApiParamsSchema = z.object({
52
+ definition: z.string().optional().describe(
53
+ "API definition content (OpenAPI/AsyncAPI in JSON or YAML). Provide this or owner/apiName/version, not both."
54
+ ),
55
+ owner: z.string().optional().describe(
56
+ "API owner (organization or user). Use with apiName and version to fetch an existing API from the registry."
57
+ ),
58
+ apiName: z.string().optional().describe("API name"),
59
+ version: z.string().optional().describe("Version identifier"),
60
+ maxProblems: z.number().int().min(1).max(1e3).optional().describe(
61
+ "Cap on the number of findings returned (default 100, max 1000)"
62
+ ),
63
+ uri: z.string().optional().describe(
64
+ "Optional pseudo-URI hint for the parser (e.g. inmemory://spec.yaml)"
65
+ )
66
+ }).refine(
67
+ (data) => Boolean(data.definition) !== Boolean(data.owner && data.apiName && data.version),
68
+ {
69
+ message: "Provide either 'definition' OR 'owner' + 'apiName' + 'version', not both and not neither.",
70
+ path: ["definition"]
71
+ }
72
+ );
51
73
  const CreateApiFromPromptParamsSchema = z.object({
52
74
  owner: z.string().describe("API owner (organization or user, case-sensitive)"),
53
75
  apiName: z.string().describe("API name"),
@@ -116,6 +138,32 @@ const StandardizationErrorSchema = z.object({
116
138
  description: z.string().optional(),
117
139
  severity: z.string().optional()
118
140
  });
141
+ const ApidomValidationFindingSchema = z.looseObject({
142
+ line: z.number().describe("Line number where the issue was found (1-based)"),
143
+ column: z.number().optional().describe("Column number where the issue starts (0-based)"),
144
+ severity: z.enum(["error", "warning", "info"]).describe("Severity of the finding"),
145
+ message: z.string().describe("Human-readable validation message"),
146
+ code: z.union([z.number(), z.string()]).optional().describe("Rule or lint code (string or number)"),
147
+ source: z.string().optional().describe("Source of the rule")
148
+ });
149
+ const ApidomValidationOutputSchema = z.looseObject({
150
+ valid: z.boolean().optional().describe("True if the spec has no error findings"),
151
+ recognized: z.boolean().optional().describe("True if the spec was recognized as OpenAPI/AsyncAPI"),
152
+ spec: z.looseObject({
153
+ namespace: z.string().optional().describe("Detected spec namespace"),
154
+ version: z.string().optional().describe("Detected spec version"),
155
+ format: z.string().optional().describe("Detected format (JSON or YAML)"),
156
+ mediaType: z.string().optional().describe("Detected media type")
157
+ }).optional().describe("Detected specification info"),
158
+ findings: z.array(ApidomValidationFindingSchema).optional().describe("List of validation findings"),
159
+ summary: z.looseObject({
160
+ errors: z.number().optional(),
161
+ warnings: z.number().optional(),
162
+ info: z.number().optional(),
163
+ total: z.number().optional(),
164
+ durationMs: z.number().optional()
165
+ }).optional()
166
+ });
119
167
  const ScanOutputSchema = z.looseObject({
120
168
  count: z.number().optional(),
121
169
  countsBySeverity: z.record(z.string(), z.number()).optional(),
@@ -166,6 +214,8 @@ export {
166
214
  ApiDefinitionOutputSchema,
167
215
  ApiDefinitionParamsSchema,
168
216
  ApiSearchParamsSchema,
217
+ ApidomValidationFindingSchema,
218
+ ApidomValidationOutputSchema,
169
219
  CreateApiFromPromptOutputSchema,
170
220
  CreateApiFromPromptParamsSchema,
171
221
  CreateApiOutputSchema,
@@ -180,5 +230,6 @@ export {
180
230
  ScanStandardizationParamsSchema,
181
231
  SearchApisOutputSchema,
182
232
  StandardizeApiParamsSchema,
183
- StandardizeOutputSchema
233
+ StandardizeOutputSchema,
234
+ ValidateApiParamsSchema
184
235
  };
@@ -1,6 +1,6 @@
1
1
  import { FUNCTIONAL_TESTING_TOOLS } from "./functional-testing-tools.js";
2
2
  import { PortalsListOutputSchema, PortalOutputSchema, CreatePortalArgsSchema, PortalArgsSchema, UpdatePortalArgsSchema, ResolvePortalOutputSchema, ResolveOrganizationPortalArgsSchema, ProductsListOutputSchema, ProductOutputSchema, CreateProductArgsSchema, ProductArgsSchema, DeleteProductOutputSchema, UpdateProductArgsSchema, PublishOutputSchema, PublishProductArgsSchema, SectionsListOutputSchema, GetProductSectionsArgsSchema, CreateTocOutputSchema, CreateTableOfContentsArgsSchema, TocListOutputSchema, GetTableOfContentsArgsSchema, DeleteTableOfContentsOutputSchema, DeleteTableOfContentsArgsSchema, CreateDocPageOutputSchema, CreateDocumentationPageArgsSchema, DocumentOutputSchema, GetDocumentArgsSchema, UpdateDocumentArgsSchema } from "./portal-types.js";
3
- import { SearchApisOutputSchema, ApiSearchParamsSchema, ApiDefinitionOutputSchema, ApiDefinitionParamsSchema, CreateApiOutputSchema, CreateApiParamsSchema, ScanOutputSchema, ScanStandardizationParamsSchema, ScanFromRegistryOutputSchema, ScanApiStandardizationFromRegistryParamsSchema, CreateApiFromPromptOutputSchema, CreateApiFromPromptParamsSchema, StandardizeOutputSchema, StandardizeApiParamsSchema, PatchApiOutputSchema, PatchApiParamsSchema } from "./registry-types.js";
3
+ import { SearchApisOutputSchema, ApiSearchParamsSchema, ApiDefinitionOutputSchema, ApiDefinitionParamsSchema, CreateApiOutputSchema, CreateApiParamsSchema, ScanOutputSchema, ScanStandardizationParamsSchema, ScanFromRegistryOutputSchema, ScanApiStandardizationFromRegistryParamsSchema, ApidomValidationOutputSchema, ValidateApiParamsSchema, CreateApiFromPromptOutputSchema, CreateApiFromPromptParamsSchema, StandardizeOutputSchema, StandardizeApiParamsSchema, PatchApiOutputSchema, PatchApiParamsSchema } from "./registry-types.js";
4
4
  import { READ_ONLY, WRITE, WRITE_DESTRUCTIVE } from "./tool-constants.js";
5
5
  import { OrganizationsListOutputSchema, OrganizationsQuerySchema } from "./user-management-types.js";
6
6
  const TOOLS = [
@@ -228,6 +228,15 @@ const TOOLS = [
228
228
  handler: "scanApiStandardizationFromRegistry",
229
229
  ...READ_ONLY
230
230
  },
231
+ {
232
+ title: "Validate API",
233
+ toolset: "Registry API",
234
+ summary: "Validate an OpenAPI or AsyncAPI definition using server-side apidom-ls. Returns structured diagnostics with line number, severity, and message for each finding. Supports OpenAPI 2.0, 3.0, 3.1, and AsyncAPI. Provide either the raw definition (JSON or YAML) OR an existing API by owner, apiName, and version. Use this tool when the user asks to validate, lint, or check an API spec for structural errors matching the Studio Validation tab.",
235
+ inputSchema: ValidateApiParamsSchema,
236
+ outputSchema: ApidomValidationOutputSchema,
237
+ handler: "validateApi",
238
+ ...READ_ONLY
239
+ },
231
240
  {
232
241
  title: "Create API from Prompt",
233
242
  toolset: "Registry API",
@@ -169,6 +169,9 @@ class SwaggerClient {
169
169
  async scanApiStandardizationFromRegistry(args) {
170
170
  return this.getApi().scanApiStandardizationFromRegistry(args);
171
171
  }
172
+ async validateApi(args) {
173
+ return this.getApi().validateApi(args);
174
+ }
172
175
  async standardizeApi(args) {
173
176
  return this.getApi().standardizeApi(args);
174
177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbear/mcp",
3
- "version": "0.41.0",
3
+ "version": "0.41.3",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },