@smartbear/mcp 0.40.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,8 +1,9 @@
1
1
  import { enableCompileCache } from "node:module";
2
- import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
2
+ import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
3
+ import { setProcessClientIdentity, toClientIdentity } from "./client-identity.js";
3
4
  import { clientRegistry } from "./client-registry.js";
4
5
  import { USER_AGENT } from "./info.js";
5
- import { handleInitializeMessage } from "./initialize.js";
6
+ import { handleInitializeMessage, extractModernClientMeta } from "./initialize.js";
6
7
  import { SmartBearMcpServer } from "./server.js";
7
8
  import { registerShutdownHandler } from "./shutdown.js";
8
9
  import { isOptionalType, getTypeDescription } from "./zod-utils.js";
@@ -20,19 +21,8 @@ function getNoConfigMessage() {
20
21
  }
21
22
  return messages;
22
23
  }
23
- async function runStdioMode() {
24
- if (process.argv.includes("--version")) {
25
- console.log(`User-Agent: ${USER_AGENT}`);
26
- process.exit(0);
27
- } else if (process.argv.includes("--help")) {
28
- console.log(
29
- "The following environment variables can be set to configure each of the SmartBear clients:"
30
- );
31
- console.log(getNoConfigMessage().join("\n"));
32
- process.exit(0);
33
- }
34
- enableCompileCache();
35
- const server = new SmartBearMcpServer(process.env.MCP_TOOLSETS);
24
+ async function buildStdioServer(era = "legacy") {
25
+ const server = new SmartBearMcpServer(process.env.MCP_TOOLSETS, era);
36
26
  const configuredCount = await clientRegistry.configure(
37
27
  server,
38
28
  (client, key) => {
@@ -50,21 +40,91 @@ ${message.join("\n")}` : "No clients support environment variable configuration.
50
40
  await server.addClient(entry);
51
41
  }
52
42
  }
43
+ return server;
44
+ }
45
+ function createInitializeCaptureTap() {
46
+ let activeServer;
47
+ const pending = [];
48
+ return {
49
+ observe(message) {
50
+ const modernMeta = extractModernClientMeta(message);
51
+ if (modernMeta) {
52
+ setProcessClientIdentity(
53
+ toClientIdentity(modernMeta.clientInfo, modernMeta.protocolVersion)
54
+ );
55
+ return;
56
+ }
57
+ if (activeServer) {
58
+ handleInitializeMessage(activeServer, message);
59
+ return;
60
+ }
61
+ pending.push(message);
62
+ },
63
+ attachServer(server) {
64
+ activeServer = server;
65
+ for (const message of pending) {
66
+ handleInitializeMessage(server, message);
67
+ }
68
+ pending.length = 0;
69
+ }
70
+ };
71
+ }
72
+ async function runStdioMode() {
73
+ if (process.argv.includes("--version")) {
74
+ console.log(`User-Agent: ${USER_AGENT}`);
75
+ process.exit(0);
76
+ } else if (process.argv.includes("--help")) {
77
+ console.log(
78
+ "The following environment variables can be set to configure each of the SmartBear clients:"
79
+ );
80
+ console.log(getNoConfigMessage().join("\n"));
81
+ process.exit(0);
82
+ }
83
+ enableCompileCache();
53
84
  const transport = new StdioServerTransport();
85
+ const capture = createInitializeCaptureTap();
86
+ let onmessage;
87
+ Object.defineProperty(transport, "onmessage", {
88
+ configurable: true,
89
+ get: () => onmessage,
90
+ set: (handler) => {
91
+ onmessage = (message) => {
92
+ capture.observe(message);
93
+ handler?.(message);
94
+ };
95
+ }
96
+ });
97
+ const handle = serveStdio(
98
+ async (ctx) => {
99
+ const server = await buildStdioServer(ctx.era);
100
+ capture.attachServer(server);
101
+ return server;
102
+ },
103
+ {
104
+ // Serve 2025-era openings alongside modern ones (this is also the
105
+ // default; stated explicitly so the backwards-compatibility guarantee
106
+ // is visible at the call site).
107
+ legacy: "serve",
108
+ transport,
109
+ onerror: (error) => {
110
+ console.error("[MCP][stdio] Transport error:", error);
111
+ }
112
+ }
113
+ );
54
114
  registerShutdownHandler("stdio-transport", async () => {
55
115
  try {
56
- await transport.close();
116
+ await handle.close();
57
117
  } catch (err) {
58
118
  console.error("[MCP][shutdown] Error closing stdio transport:", err);
59
119
  }
60
120
  });
61
- transport.onmessage = (message) => handleInitializeMessage(server, message);
62
- await server.connect(transport);
63
121
  }
64
122
  function getEnvVarName(clientPrefix, key) {
65
123
  return `${clientPrefix.toUpperCase().replace(/-/g, "_")}_${key.toUpperCase()}`;
66
124
  }
67
125
  export {
126
+ buildStdioServer,
127
+ createInitializeCaptureTap,
68
128
  getEnvVarName,
69
129
  runStdioMode
70
130
  };
@@ -1,4 +1,4 @@
1
- const version = "0.40.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
@@ -232,7 +232,7 @@ class FunctionalTestingAPI {
232
232
  ],
233
233
  [
234
234
  409,
235
- "Suite execution cannot be cancelled because it has already finished."
235
+ "Suite execution cannot be canceled because it has already finished."
236
236
  ]
237
237
  ]),
238
238
  errorMessageFor("cancel suite execution")
@@ -4,7 +4,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
4
4
  {
5
5
  title: "List Tests",
6
6
  toolset: "Functional Testing",
7
- summary: "Lists all API tests available in your Swagger Functional Testing account. Use this tool when you need to discover available tests before running them or checking their status. Do not use this tool to retrieve test execution results or history.",
7
+ summary: "Lists all API tests available in your Swagger Functional Testing account. Use this tool when you need to discover available tests before running them or checking their status. Returns test IDs usable with `swagger_run_test` to execute a single test, or passable to `swagger_create_suite` to group tests into a suite. Do not use this tool to retrieve test execution results or history.",
8
8
  handler: "listFunctionalTestingTests",
9
9
  idempotent: true,
10
10
  ...READ_ONLY
@@ -32,7 +32,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
32
32
  {
33
33
  title: "Get Test Status",
34
34
  toolset: "Functional Testing",
35
- summary: "Get the status of a Swagger Functional Testing test execution. It returns information about the execution such as its status (running, passed or failed), run time, as well as the break down of the status of each test step.",
35
+ summary: "Get the status of a Swagger Functional Testing test execution. Returns the execution status (`running`, `passed`, or `failed`), run time, and a per-step breakdown. Poll this tool after calling `swagger_run_test` until status is `passed` or `failed`; `running` means the execution is still in progress.",
36
36
  inputSchema: GetFunctionalTestingExecutionTestSchema,
37
37
  handler: "getFunctionalTestingExecution",
38
38
  idempotent: true,
@@ -50,7 +50,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
50
50
  {
51
51
  title: "Cancel Suite Execution",
52
52
  toolset: "Functional Testing",
53
- summary: "Cancels an ongoing test suite execution in your Swagger Functional Testing workspace. Use this tool when you need to stop a long-running or accidentally triggered suite run. Do not use this tool to cancel individual test runs.",
53
+ summary: "Cancels an ongoing test suite execution in your Swagger Functional Testing workspace. Use this tool when you need to stop a long-running or accidentally triggered suite run. The canceled execution is preserved in run history with status `canceled`. Do not use this tool to cancel individual test runs.",
54
54
  inputSchema: CancelFunctionalTestingSuiteExecutionSchema,
55
55
  handler: "cancelFunctionalTestingSuiteExecution",
56
56
  ...WRITE_DESTRUCTIVE,
@@ -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 the suite's `slug` and the `executionId` 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, runtime, step count, and for failed tests a `failedStepsByIndex` map of step index to error message. `pending` means the execution has not yet finished (queued or actively running). Poll this tool after calling `swagger_run_suite` until `finished` is `true`. 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,
@@ -96,7 +96,7 @@ const FUNCTIONAL_TESTING_TOOLS = [
96
96
  {
97
97
  title: "Get Test Execution History",
98
98
  toolset: "Functional Testing",
99
- summary: "Retrieves the execution history for a given test in your Swagger Functional Testing workspace. Returns a list of past runs, each including pass/fail status, run time, creation timestamp, and — for failed runs — a per-step breakdown of failure details. Use this tool when you need to check past run results, identify failures, or assess test reliability over time. Do not use this tool to run a test or retrieve suite-level execution results.",
99
+ summary: "Retrieves the execution history for a given test in your Swagger Functional Testing workspace. Returns the total run count and a list of past runs, each including pass/fail status, run time, creation timestamp, and — for failed runs — a per-step breakdown of failure details. Supports pagination via `limit` (1–100, default 25) and `offset` (default 0). Use this tool when you need to check past run results, identify failures, or assess test reliability over time. Do not use this tool to run a test or retrieve suite-level execution results.",
100
100
  inputSchema: GetFunctionalTestHistoryParamsSchema,
101
101
  handler: "getFunctionalTestingTestHistory",
102
102
  idempotent: true,
@@ -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
  }
@@ -1,5 +1,9 @@
1
+ import { z } from "zod";
1
2
  import { Tool } from "../../../common/tools.js";
2
3
  import { GetIssueLinkTestCases200Response, GetIssueLinkTestCasesParams } from "../../common/rest-api-schemas.js";
4
+ const UpdatedGetIssueLinkTestCasesResponse = z.strictObject({
5
+ testCases: GetIssueLinkTestCases200Response
6
+ });
3
7
  class GetTestCases extends Tool {
4
8
  specification = {
5
9
  title: "Get Issue Link Test Cases",
@@ -8,7 +12,7 @@ class GetTestCases extends Tool {
8
12
  readOnly: true,
9
13
  idempotent: true,
10
14
  inputSchema: GetIssueLinkTestCasesParams,
11
- outputSchema: GetIssueLinkTestCases200Response,
15
+ outputSchema: UpdatedGetIssueLinkTestCasesResponse,
12
16
  examples: [
13
17
  {
14
18
  description: "Check which test cases are linked to Jira issue PROJ-123",
@@ -30,5 +34,6 @@ class GetTestCases extends Tool {
30
34
  };
31
35
  }
32
36
  export {
33
- GetTestCases
37
+ GetTestCases,
38
+ UpdatedGetIssueLinkTestCasesResponse
34
39
  };
@@ -1,5 +1,9 @@
1
+ import { z } from "zod";
1
2
  import { Tool } from "../../../common/tools.js";
2
3
  import { GetIssueLinkTestCycles200Response, GetIssueLinkTestCyclesParams } from "../../common/rest-api-schemas.js";
4
+ const UpdatedGetIssueLinkTestCyclesResponse = z.strictObject({
5
+ testCycles: GetIssueLinkTestCycles200Response
6
+ });
3
7
  class GetTestCycles extends Tool {
4
8
  specification = {
5
9
  title: "Get Test Cycles linked to a Jira issue",
@@ -8,7 +12,7 @@ class GetTestCycles extends Tool {
8
12
  readOnly: true,
9
13
  idempotent: true,
10
14
  inputSchema: GetIssueLinkTestCyclesParams,
11
- outputSchema: GetIssueLinkTestCycles200Response,
15
+ outputSchema: UpdatedGetIssueLinkTestCyclesResponse,
12
16
  examples: [
13
17
  {
14
18
  description: "Check which test cycles are linked to Jira issue PROJ-123",
@@ -29,5 +33,6 @@ class GetTestCycles extends Tool {
29
33
  };
30
34
  }
31
35
  export {
32
- GetTestCycles
36
+ GetTestCycles,
37
+ UpdatedGetIssueLinkTestCyclesResponse
33
38
  };
@@ -1,5 +1,9 @@
1
+ import { z } from "zod";
1
2
  import { Tool } from "../../../common/tools.js";
2
3
  import { GetIssueLinkTestExecutions200Response, GetIssueLinkTestExecutionsParams } from "../../common/rest-api-schemas.js";
4
+ const UpdatedGetIssueLinkTestExecutionsResponse = z.strictObject({
5
+ testExecutions: GetIssueLinkTestExecutions200Response
6
+ });
3
7
  class GetTestExecutions extends Tool {
4
8
  specification = {
5
9
  title: "Get test executions linked to a Jira issue",
@@ -8,7 +12,7 @@ class GetTestExecutions extends Tool {
8
12
  readOnly: true,
9
13
  idempotent: true,
10
14
  inputSchema: GetIssueLinkTestExecutionsParams,
11
- outputSchema: GetIssueLinkTestExecutions200Response,
15
+ outputSchema: UpdatedGetIssueLinkTestExecutionsResponse,
12
16
  examples: [
13
17
  {
14
18
  description: "Check which test executions are linked to Jira issue PROJ-123",
@@ -29,5 +33,6 @@ class GetTestExecutions extends Tool {
29
33
  };
30
34
  }
31
35
  export {
32
- GetTestExecutions
36
+ GetTestExecutions,
37
+ UpdatedGetIssueLinkTestExecutionsResponse
33
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbear/mcp",
3
- "version": "0.40.0",
3
+ "version": "0.41.3",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },