@smartbear/mcp 0.39.0 → 0.41.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.
Files changed (45) hide show
  1. package/README.md +7 -0
  2. package/dist/common/cache.js +13 -3
  3. package/dist/common/initialize.js +21 -0
  4. package/dist/common/pollyfills.js +70 -1
  5. package/dist/common/request-context.js +28 -2
  6. package/dist/common/server.js +103 -13
  7. package/dist/common/transport-http.js +146 -22
  8. package/dist/common/transport-stdio.js +78 -18
  9. package/dist/package.json.js +1 -1
  10. package/dist/qmetry/client/auto-resolve.js +7 -0
  11. package/dist/qmetry/client/handlers.js +5 -2
  12. package/dist/qmetry/client/issues.js +8 -1
  13. package/dist/qmetry/client/project.js +103 -2
  14. package/dist/qmetry/client/requirement.js +99 -3
  15. package/dist/qmetry/client/testcase.js +51 -2
  16. package/dist/qmetry/client/testsuite.js +7 -1
  17. package/dist/qmetry/client/tools/issue-tools.js +1 -15
  18. package/dist/qmetry/client/tools/project-tools.js +2 -2
  19. package/dist/qmetry/client/tools/requirement-tools.js +124 -11
  20. package/dist/qmetry/client/tools/testcase-tools.js +116 -56
  21. package/dist/qmetry/client/tools/testsuite-tools.js +1 -19
  22. package/dist/qmetry/client/tools/udf-tools.js +15 -4
  23. package/dist/qmetry/client/udf.js +2 -2
  24. package/dist/qmetry/client.js +19 -11
  25. package/dist/qmetry/config/constants.js +3 -0
  26. package/dist/qmetry/config/rest-endpoints.js +4 -2
  27. package/dist/qmetry/types/ai-agent.js +8 -4
  28. package/dist/qmetry/types/common.js +69 -43
  29. package/dist/qmetry/types/requirements.js +7 -1
  30. package/dist/qmetry/types/testcase.js +2 -1
  31. package/dist/qmetry/types/udf.js +5 -12
  32. package/dist/swagger/client/api.js +29 -4
  33. package/dist/swagger/client/functional-testing-api.js +18 -11
  34. package/dist/swagger/client/functional-testing-tools.js +6 -6
  35. package/dist/swagger/client/functional-testing-types.js +65 -2
  36. package/dist/swagger/client/functional-testing-url-utils.js +110 -0
  37. package/dist/swagger/client/registry-types.js +2 -2
  38. package/dist/swagger/client/tools.js +2 -2
  39. package/dist/zephyr/client.js +2 -0
  40. package/dist/zephyr/common/rest-api-schemas.js +345 -4
  41. package/dist/zephyr/tool/folder/get-folders.js +69 -0
  42. package/dist/zephyr/tool/issue-link/get-test-cases.js +7 -2
  43. package/dist/zephyr/tool/issue-link/get-test-cycles.js +7 -2
  44. package/dist/zephyr/tool/issue-link/get-test-executions.js +7 -2
  45. package/package.json +1 -1
@@ -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.39.0";
1
+ const version = "0.41.0";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -22,6 +22,13 @@ const AUTO_RESOLVE_MODULES = [
22
22
  viewIdPath: "latestViews.RQ.viewId",
23
23
  moduleName: "Requirements"
24
24
  },
25
+ {
26
+ handler: QMetryToolsHandlers.CREATE_REQUIREMENT,
27
+ folderIdPath: "rootFolders.RQ.id",
28
+ folderIdField: "rqFolderId",
29
+ folderIdAsString: true,
30
+ moduleName: "Requirements"
31
+ },
25
32
  {
26
33
  handler: QMetryToolsHandlers.FETCH_TEST_SUITES,
27
34
  viewIdPath: "latestViews.TS.viewId",
@@ -3,8 +3,8 @@ import { exportHtmlReport, executeGateReport, getGateConfiguration } from "./ai-
3
3
  import { getAutomationStatus, importAutomationResults } from "./automation.js";
4
4
  import { fetchIssueExecutions, linkIssuesToTestcaseRun, fetchIssueDetails, fetchIssues, updateIssue, createIssue, fetchIssuesLinkedToTestCase } from "./issues.js";
5
5
  import { updateCycle, createCycle, createRelease, getPlatforms, getBuilds, getReleasesCycles, getProjectInfo, getProjects } from "./project.js";
6
- import { fetchRequirementsLinkedToTestCase, fetchRequirementDetails, fetchRequirements } from "./requirement.js";
7
- import { fetchTestCasesLinkedToRequirement, linkRequirementToTestCase, fetchTestCaseExecutions, fetchTestCaseStepsWithUdf, fetchTestCaseSteps, fetchTestCaseVersionDetails, fetchTestCaseDetails, fetchTestCases, updateTestCase, createTestCases } from "./testcase.js";
6
+ import { fetchRequirementsLinkedToTestCase, fetchRequirementDetails, fetchRequirements, updateRequirement, createRequirement } from "./requirement.js";
7
+ import { fetchTestCasesLinkedToRequirement, linkTestcaseToIssues, linkRequirementToTestCase, fetchTestCaseExecutions, fetchTestCaseStepsWithUdf, fetchTestCaseSteps, fetchTestCaseVersionDetails, fetchTestCaseDetails, fetchTestCases, updateTestCase, createTestCases } from "./testcase.js";
8
8
  import { linkPlatformsToTestSuite, fetchLinkedIssuesByTestCaseRun, fetchTestCaseRunsByTestSuiteRun, bulkUpdateExecutionStatus, fetchExecutionsByTestSuite, fetchTestCasesByTestSuite, reqLinkedTestCasesToTestSuite, linkTestCasesToTestSuite, fetchTestSuitesForTestCase, fetchTestSuiteDetails, fetchTestSuites, updateTestSuite, createTestSuites } from "./testsuite.js";
9
9
  import { fetchUdfLayout, fetchCascadeChildValues, fetchTestRunUdfValues, fetchTestRunUdfMetadata, bulkUpdateTestRunUdfs, fetchUdfModules, fetchUdfFieldTypes } from "./udf.js";
10
10
  const QMETRY_HANDLER_MAP = {
@@ -26,6 +26,9 @@ const QMETRY_HANDLER_MAP = {
26
26
  [QMetryToolsHandlers.FETCH_TEST_CASE_STEPS_WITH_UDF]: fetchTestCaseStepsWithUdf,
27
27
  [QMetryToolsHandlers.FETCH_TEST_CASE_EXECUTIONS]: fetchTestCaseExecutions,
28
28
  [QMetryToolsHandlers.LINK_REQUIREMENT_TO_TESTCASE]: linkRequirementToTestCase,
29
+ [QMetryToolsHandlers.LINK_TESTCASE_TO_ISSUES]: linkTestcaseToIssues,
30
+ [QMetryToolsHandlers.CREATE_REQUIREMENT]: createRequirement,
31
+ [QMetryToolsHandlers.UPDATE_REQUIREMENT]: updateRequirement,
29
32
  [QMetryToolsHandlers.FETCH_REQUIREMENTS]: fetchRequirements,
30
33
  [QMetryToolsHandlers.FETCH_REQUIREMENT_DETAILS]: fetchRequirementDetails,
31
34
  [QMetryToolsHandlers.FETCH_TESTCASES_LINKED_TO_REQUIREMENT]: fetchTestCasesLinkedToRequirement,
@@ -121,7 +121,7 @@ async function fetchIssues(token, baseUrl, project, payload) {
121
121
  "[fetchIssues] Missing or invalid required parameter: 'viewId'."
122
122
  );
123
123
  }
124
- return qmetryRequest({
124
+ const result = await qmetryRequest({
125
125
  method: "POST",
126
126
  path: QMETRY_PATHS.ISSUES.GET_ISSUES_LIST,
127
127
  token,
@@ -129,6 +129,12 @@ async function fetchIssues(token, baseUrl, project, payload) {
129
129
  baseUrl: resolvedBaseUrl,
130
130
  body
131
131
  });
132
+ const {
133
+ filterTemplate: _filterTemplate,
134
+ columns: _columns,
135
+ ...rest
136
+ } = result;
137
+ return rest;
132
138
  }
133
139
  async function fetchIssuesLinkedToTestCase(token, baseUrl, project, payload) {
134
140
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
@@ -350,6 +356,7 @@ async function fetchIssueDetails(token, baseUrl, project, payload) {
350
356
  if (typeof payload.orgCode === "string") {
351
357
  extraHeaders["orgcode"] = payload.orgCode;
352
358
  }
359
+ extraHeaders["Content-Type"] = "application/json";
353
360
  return qmetryRequest({
354
361
  method: "GET",
355
362
  path: url,
@@ -3,21 +3,109 @@ import { QMETRY_PATHS } from "../config/rest-endpoints.js";
3
3
  import { DEFAULT_CREATE_CYCLE_PAYLOAD, DEFAULT_CREATE_RELEASE_PAYLOAD, DEFAULT_FETCH_PROJECTS_PAYLOAD, DEFAULT_FETCH_BUILD_PAYLOAD, DEFAULT_FETCH_PLATFORMS_PAYLOAD } from "../types/project.js";
4
4
  import { qmetryRequest } from "./api/client-api.js";
5
5
  import { resolveDefaults } from "./utils.js";
6
+ const PROJECT_LIST_FIELDS_TO_OMIT = /* @__PURE__ */ new Set([
7
+ "userDefault",
8
+ "isRichText",
9
+ "isAutoAddValue",
10
+ "isSyncTCMailSend",
11
+ "isPartLevelComplianceEnabled",
12
+ "isBuildSelectionMandatory",
13
+ "isDeriveTCRStatusFromTCSRStatus",
14
+ "isDefineTestCaseDependency",
15
+ "isAutoSyncNewTcVersionEnabled",
16
+ "isTCSRPartLevelComplianceDisabled"
17
+ ]);
18
+ const PROJECT_FIELDS_TO_OMIT = /* @__PURE__ */ new Set([
19
+ "clientData",
20
+ "disabledRoleRights",
21
+ "automationFrameworks",
22
+ "currentUserRoleRights",
23
+ "userRoleRights",
24
+ "licenseDetail",
25
+ "bddRepos",
26
+ "atgTCFields",
27
+ "allowEditRecordData",
28
+ "allowEditPublicView",
29
+ "logiServerUrl",
30
+ "dynamicWebhookEnabled",
31
+ "isLocked",
32
+ "isBuildLOcked",
33
+ "isReleaseLocked",
34
+ "isProjectLocked",
35
+ "cicdRequestTimeoutInSeconds",
36
+ "thumbnailCreated",
37
+ "qisearchBearerToken",
38
+ "openAISecretKey",
39
+ "openAISalt",
40
+ "qmetrySamlUrl",
41
+ "qmetrySAMLContext",
42
+ "BDD_MQ_NAME",
43
+ "riskBasedAnalysisEnabled",
44
+ "riskBasedAtRQLevel",
45
+ "riskBasedAtTCLevel",
46
+ "isDropMandatory",
47
+ "isPlatformScopeFeatureEnabled",
48
+ "isSyncAcrossDomainEnabled",
49
+ "isTestDataEnabled",
50
+ "isTestCaseApprover",
51
+ "isTestSuiteApprover",
52
+ "isTestSuiteCloser",
53
+ "isRequirementReviewer",
54
+ "isApprovalWorkflowEnabled",
55
+ "isPartLevelComplianceEnabled",
56
+ "isAutoApproveTestRunEnabled",
57
+ "isDeriveTCRStatusFromTCSRStatus",
58
+ "isDefineTestCaseDependency",
59
+ "isAutoSyncNewTcVersionEnabled",
60
+ "isBddConfigured",
61
+ "isMFAMandatory",
62
+ "part11ComplianceAuthType",
63
+ "userPreferredAutoActivatePrediction",
64
+ "isQIEnabled",
65
+ "isReflectEnabled",
66
+ "isAskMeAnythingEnabledAI",
67
+ "isDocLinkConfigForProjectAI",
68
+ "isNetSearchConfigForProjectAI",
69
+ "isAutoGenerateTcTcStepsAI",
70
+ "isGenerateNewTcInExistingTcAI",
71
+ "isEditTcStepsInExistingTcAI",
72
+ "isGenerateNewTcForStoryAI",
73
+ "isFlakyScoreEnabled",
74
+ "isSuccessRateEnabled",
75
+ "isQueryAssistanceEnabledClient",
76
+ "isQueryAssistanceEnabledUser",
77
+ "isDocSearchEnabled",
78
+ "isTestingTypeVisible",
79
+ "isMatrixViewEnabled",
80
+ "isTCSRPartLevelComplianceDisabled",
81
+ "isProjectLogoCustomization",
82
+ "alEvents",
83
+ "alModules",
84
+ "isScimEnabled",
85
+ "atgJiraFields",
86
+ "nomenclature",
87
+ "nomenclatureInfo",
88
+ "refreshContent",
89
+ "packages"
90
+ ]);
6
91
  async function getProjectInfo(token, baseUrl, project) {
7
- return qmetryRequest({
92
+ const result = await qmetryRequest({
8
93
  method: "GET",
9
94
  path: QMETRY_PATHS.PROJECT.GET_INFO,
10
95
  token,
11
96
  baseUrl: baseUrl || QMETRY_DEFAULTS.BASE_URL,
12
97
  project: project || QMETRY_DEFAULTS.PROJECT_KEY
13
98
  });
99
+ return Object.fromEntries(
100
+ Object.entries(result).filter(([key]) => !PROJECT_FIELDS_TO_OMIT.has(key))
101
+ );
14
102
  }
15
103
  async function getProjects(token, baseUrl, project, payload) {
16
104
  const body = {
17
105
  ...DEFAULT_FETCH_PROJECTS_PAYLOAD,
18
106
  ...payload
19
107
  };
20
- return qmetryRequest({
108
+ const result = await qmetryRequest({
21
109
  method: "POST",
22
110
  path: QMETRY_PATHS.PROJECT.GET_PROJECTS,
23
111
  token,
@@ -25,6 +113,19 @@ async function getProjects(token, baseUrl, project, payload) {
25
113
  project: project || QMETRY_DEFAULTS.PROJECT_KEY,
26
114
  body
27
115
  });
116
+ if (result && Array.isArray(result.data)) {
117
+ return {
118
+ ...result,
119
+ data: result.data.map(
120
+ (item) => Object.fromEntries(
121
+ Object.entries(item).filter(
122
+ ([key]) => !PROJECT_LIST_FIELDS_TO_OMIT.has(key)
123
+ )
124
+ )
125
+ )
126
+ };
127
+ }
128
+ return result;
28
129
  }
29
130
  async function getReleasesCycles(token, baseUrl, project, payload = {}) {
30
131
  let showArchiveValue;
@@ -1,7 +1,95 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
- import { DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD, DEFAULT_FETCH_REQUIREMENTS_PAYLOAD } from "../types/requirements.js";
2
+ import { DEFAULT_FETCH_REQUIREMENTS_LINKED_TO_TESTCASE_PAYLOAD, DEFAULT_FETCH_REQUIREMENT_DETAILS_PAYLOAD, DEFAULT_FETCH_REQUIREMENTS_PAYLOAD, DEFAULT_UPDATE_REQUIREMENT_PAYLOAD, DEFAULT_CREATE_REQUIREMENT_PAYLOAD } from "../types/requirements.js";
3
3
  import { qmetryRequest } from "./api/client-api.js";
4
+ import { getProjectInfo } from "./project.js";
4
5
  import { resolveDefaults } from "./utils.js";
6
+ const EXT_TRACKER_TYPE_JIRA = 1;
7
+ const EXT_TRACKER_TYPE_AZURE = 3;
8
+ async function assertRequirementNotExternallySynced(token, baseUrl, project, functionName, action) {
9
+ const projectInfo = await getProjectInfo(token, baseUrl, project);
10
+ if (projectInfo.isExtTrackerConfigured === true && projectInfo.isRQConfigured === true) {
11
+ const trackerType = projectInfo.extTrackerType;
12
+ if (trackerType === EXT_TRACKER_TYPE_JIRA) {
13
+ throw new Error(
14
+ `[${functionName}] Blocked: This project is Jira-integrated and the Requirement module is configured to sync with Jira issue types. Requirements must be ${action} in Jira, not QMetry, for this project.`
15
+ );
16
+ }
17
+ if (trackerType === EXT_TRACKER_TYPE_AZURE) {
18
+ throw new Error(
19
+ `[${functionName}] Blocked: This project is Azure-integrated and the Requirement module is configured to sync with Azure. Requirements must be ${action} in Azure, not QMetry, for this project.`
20
+ );
21
+ }
22
+ }
23
+ }
24
+ async function createRequirement(token, baseUrl, project, payload) {
25
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
26
+ baseUrl,
27
+ project
28
+ );
29
+ const { udfFields, ...restPayload } = payload;
30
+ const body = {
31
+ ...DEFAULT_CREATE_REQUIREMENT_PAYLOAD,
32
+ ...restPayload,
33
+ ...udfFields ?? {}
34
+ };
35
+ if (typeof body.name !== "string" || body.name.trim() === "") {
36
+ throw new Error(
37
+ "[createRequirement] Missing or invalid required parameter: 'name'."
38
+ );
39
+ }
40
+ await assertRequirementNotExternallySynced(
41
+ token,
42
+ resolvedBaseUrl,
43
+ resolvedProject,
44
+ "createRequirement",
45
+ "created"
46
+ );
47
+ return qmetryRequest({
48
+ method: "POST",
49
+ path: QMETRY_PATHS.REQUIREMENT.CREATE_UPDATE_RQ,
50
+ token,
51
+ project: resolvedProject,
52
+ baseUrl: resolvedBaseUrl,
53
+ body
54
+ });
55
+ }
56
+ async function updateRequirement(token, baseUrl, project, payload) {
57
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
58
+ baseUrl,
59
+ project
60
+ );
61
+ const { udfFields, ...restPayload } = payload;
62
+ const body = {
63
+ ...DEFAULT_UPDATE_REQUIREMENT_PAYLOAD,
64
+ ...restPayload,
65
+ ...udfFields ?? {}
66
+ };
67
+ if (typeof body.rqId !== "number") {
68
+ throw new Error(
69
+ "[updateRequirement] Missing or invalid required parameter: 'rqId'."
70
+ );
71
+ }
72
+ if (typeof body.rqVersionId !== "number") {
73
+ throw new Error(
74
+ "[updateRequirement] Missing or invalid required parameter: 'rqVersionId'."
75
+ );
76
+ }
77
+ await assertRequirementNotExternallySynced(
78
+ token,
79
+ resolvedBaseUrl,
80
+ resolvedProject,
81
+ "updateRequirement",
82
+ "updated"
83
+ );
84
+ return qmetryRequest({
85
+ method: "PUT",
86
+ path: QMETRY_PATHS.REQUIREMENT.CREATE_UPDATE_RQ,
87
+ token,
88
+ project: resolvedProject,
89
+ baseUrl: resolvedBaseUrl,
90
+ body
91
+ });
92
+ }
5
93
  async function fetchRequirements(token, baseUrl, project, payload) {
6
94
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
7
95
  baseUrl,
@@ -21,7 +109,7 @@ async function fetchRequirements(token, baseUrl, project, payload) {
21
109
  "[fetchRequirements] Missing or invalid required parameter: 'folderPath'."
22
110
  );
23
111
  }
24
- return qmetryRequest({
112
+ const result = await qmetryRequest({
25
113
  method: "POST",
26
114
  path: QMETRY_PATHS.REQUIREMENT.GET_RQ_LIST,
27
115
  token,
@@ -29,6 +117,12 @@ async function fetchRequirements(token, baseUrl, project, payload) {
29
117
  baseUrl: resolvedBaseUrl,
30
118
  body
31
119
  });
120
+ const {
121
+ filterTemplate: _filterTemplate,
122
+ columns: _columns,
123
+ ...rest
124
+ } = result;
125
+ return rest;
32
126
  }
33
127
  async function fetchRequirementDetails(token, baseUrl, project, payload) {
34
128
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
@@ -82,7 +176,9 @@ async function fetchRequirementsLinkedToTestCase(token, baseUrl, project, payloa
82
176
  });
83
177
  }
84
178
  export {
179
+ createRequirement,
85
180
  fetchRequirementDetails,
86
181
  fetchRequirements,
87
- fetchRequirementsLinkedToTestCase
182
+ fetchRequirementsLinkedToTestCase,
183
+ updateRequirement
88
184
  };
@@ -7,7 +7,7 @@ async function createTestCases(token, baseUrl, project, payload) {
7
7
  baseUrl,
8
8
  project
9
9
  );
10
- const { udfFields, ...restPayload } = payload;
10
+ const { udfFields, skipSteps, ...restPayload } = payload;
11
11
  const body = {
12
12
  ...DEFAULT_CREATE_TESTCASES_PAYLOAD,
13
13
  ...udfFields ?? {},
@@ -23,6 +23,19 @@ async function createTestCases(token, baseUrl, project, payload) {
23
23
  "[createTestCases] Missing or invalid required parameter: 'name'."
24
24
  );
25
25
  }
26
+ if (!skipSteps && (!Array.isArray(body.steps) || body.steps.length === 0)) {
27
+ throw new Error(
28
+ "[createTestCases] Missing or invalid required parameter: 'steps' — must be a non-empty array. Generate steps from context if the user did not provide them."
29
+ );
30
+ }
31
+ if (skipSteps && Array.isArray(body.steps) && body.steps.length > 0) {
32
+ throw new Error(
33
+ "[createTestCases] Contradictory payload: 'skipSteps' is true but 'steps' contains entries. Remove the steps array or set skipSteps to false."
34
+ );
35
+ }
36
+ if (skipSteps) {
37
+ delete body.steps;
38
+ }
26
39
  return qmetryRequest({
27
40
  method: "POST",
28
41
  path: QMETRY_PATHS.TESTCASE.CREATE_UPDATE_TC,
@@ -239,8 +252,13 @@ async function fetchTestCaseExecutions(token, baseUrl, project, payload) {
239
252
  body
240
253
  });
241
254
  if (result.hasTcRunUdf === false) {
255
+ const rows2 = result.data ?? [];
242
256
  return {
243
257
  ...result,
258
+ data: rows2.map((row) => {
259
+ const { testCaseStatus: _tcs, testSuiteStatus: _tss, ...rest } = row;
260
+ return rest;
261
+ }),
244
262
  testRunUdfNote: "No Test Run UDFs are configured for this project. The 'testRunUdfs' field will not be present in execution records. To enable Test Run UDF features, a project administrator must define Test Run UDF fields in the project settings."
245
263
  };
246
264
  }
@@ -312,7 +330,12 @@ async function fetchTestCaseExecutions(token, baseUrl, project, payload) {
312
330
  })
313
331
  );
314
332
  }
315
- const { udfjson: _udfjson, ...rest } = row;
333
+ const {
334
+ udfjson: _udfjson,
335
+ testCaseStatus: _tcs,
336
+ testSuiteStatus: _tss,
337
+ ...rest
338
+ } = row;
316
339
  return { ...rest, testRunUdfs };
317
340
  });
318
341
  return {
@@ -353,6 +376,31 @@ async function linkRequirementToTestCase(token, baseUrl, project, payload) {
353
376
  body
354
377
  });
355
378
  }
379
+ async function linkTestcaseToIssues(token, baseUrl, project, payload) {
380
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
381
+ baseUrl,
382
+ project
383
+ );
384
+ const body = { ...payload };
385
+ if (typeof body.tcID !== "string" || body.tcID.trim() === "") {
386
+ throw new Error(
387
+ "[linkTestcaseToIssues] Missing or invalid required parameter: 'tcID'."
388
+ );
389
+ }
390
+ if (!Array.isArray(body.dfIDs) || body.dfIDs.length === 0) {
391
+ throw new Error(
392
+ "[linkTestcaseToIssues] Missing or invalid required parameter: 'dfIDs'."
393
+ );
394
+ }
395
+ return qmetryRequest({
396
+ method: "POST",
397
+ path: QMETRY_PATHS.TESTCASE.LINK_ISSUES_TO_TC,
398
+ token,
399
+ project: resolvedProject,
400
+ baseUrl: resolvedBaseUrl,
401
+ body
402
+ });
403
+ }
356
404
  export {
357
405
  createTestCases,
358
406
  fetchTestCaseDetails,
@@ -363,5 +411,6 @@ export {
363
411
  fetchTestCases,
364
412
  fetchTestCasesLinkedToRequirement,
365
413
  linkRequirementToTestCase,
414
+ linkTestcaseToIssues,
366
415
  updateTestCase
367
416
  };
@@ -86,7 +86,7 @@ async function fetchTestSuites(token, baseUrl, project, payload) {
86
86
  "[fetchTestSuites] Missing or invalid required parameter: 'folderPath'."
87
87
  );
88
88
  }
89
- return qmetryRequest({
89
+ const result = await qmetryRequest({
90
90
  method: "POST",
91
91
  path: QMETRY_PATHS.TESTSUITE.GET_TS_LIST,
92
92
  token,
@@ -94,6 +94,12 @@ async function fetchTestSuites(token, baseUrl, project, payload) {
94
94
  baseUrl: resolvedBaseUrl,
95
95
  body
96
96
  });
97
+ const {
98
+ filterTemplate: _filterTemplate,
99
+ columns: _columns,
100
+ ...rest
101
+ } = result;
102
+ return rest;
97
103
  }
98
104
  async function fetchTestSuitesForTestCase(token, baseUrl, project, payload) {
99
105
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
@@ -325,7 +325,7 @@ const ISSUE_TOOLS = [
325
325
  summary: "Fetch QMetry defects or issues - automatically handles viewId resolution based on project",
326
326
  handler: QMetryToolsHandlers.FETCH_ISSUES,
327
327
  inputSchema: IssuesListArgsSchema,
328
- purpose: "Get defects or issues from QMetry. System automatically gets correct viewId from project info if not provided.",
328
+ purpose: "Get defects or issues from QMetry. System automatically gets correct viewId from project.",
329
329
  useCases: [
330
330
  "List all issues in a project",
331
331
  "Search for specific issues using filters",
@@ -342,20 +342,6 @@ const ISSUE_TOOLS = [
342
342
  parameters: { projectKey: "UT" },
343
343
  expectedOutput: "List of issues from UT project using UT's specific IS viewId"
344
344
  },
345
- {
346
- description: "Get issues with manual viewId (skip auto-resolution)",
347
- parameters: { projectKey: "MAC", viewId: 166065 },
348
- // This is an example viewId, must be resolved per project IS viewId
349
- expectedOutput: "Issues using manually specified viewId 166065"
350
- },
351
- {
352
- description: "List issues from specific project (ex: project key can be anything (VT, UT, PROJ1, TEST9)",
353
- parameters: {
354
- projectKey: "use specific given project key",
355
- viewId: "fetch specific project given projectKey defects or issues ViewId"
356
- },
357
- expectedOutput: "Issues using manually specified viewId 103097 or projectKey"
358
- },
359
345
  {
360
346
  description: "Get issues by release/cycle filter",
361
347
  parameters: {
@@ -67,7 +67,7 @@ const PROJECT_TOOLS = [
67
67
  "Filter parameter should be a JSON string with filter criteria",
68
68
  "Common filter fields: 'name' (string), 'projectKey' (string)"
69
69
  ],
70
- outputDescription: "JSON object containing list of projects details",
70
+ outputDescription: "JSON object containing list of projects details, including Version, Build Number(if greater than or equal to 1), Project ID, name, Project Key and Date Format",
71
71
  readOnly: true,
72
72
  idempotent: true
73
73
  },
@@ -108,7 +108,7 @@ const PROJECT_TOOLS = [
108
108
  "This operation must be performed before fetching test cases if working with non-default projects",
109
109
  "The project context persists for the current session until changed again"
110
110
  ],
111
- outputDescription: "JSON object containing project configuration details, confirmation of project switch, and available project metadata",
111
+ outputDescription: "JSON object containing project configuration details, confirmation of project switch, and available project metadata,including Version, Build Number(if greater than or equal to 1), Project ID, name, Project Key and Date Format",
112
112
  readOnly: false,
113
113
  idempotent: true
114
114
  },