@smartbear/mcp 0.39.0 → 0.40.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 (34) hide show
  1. package/dist/package.json.js +1 -1
  2. package/dist/qmetry/client/auto-resolve.js +7 -0
  3. package/dist/qmetry/client/handlers.js +5 -2
  4. package/dist/qmetry/client/issues.js +8 -1
  5. package/dist/qmetry/client/project.js +103 -2
  6. package/dist/qmetry/client/requirement.js +99 -3
  7. package/dist/qmetry/client/testcase.js +51 -2
  8. package/dist/qmetry/client/testsuite.js +7 -1
  9. package/dist/qmetry/client/tools/issue-tools.js +1 -15
  10. package/dist/qmetry/client/tools/project-tools.js +2 -2
  11. package/dist/qmetry/client/tools/requirement-tools.js +124 -11
  12. package/dist/qmetry/client/tools/testcase-tools.js +116 -56
  13. package/dist/qmetry/client/tools/testsuite-tools.js +1 -19
  14. package/dist/qmetry/client/tools/udf-tools.js +15 -4
  15. package/dist/qmetry/client/udf.js +2 -2
  16. package/dist/qmetry/client.js +19 -11
  17. package/dist/qmetry/config/constants.js +3 -0
  18. package/dist/qmetry/config/rest-endpoints.js +4 -2
  19. package/dist/qmetry/types/ai-agent.js +8 -4
  20. package/dist/qmetry/types/common.js +69 -43
  21. package/dist/qmetry/types/requirements.js +7 -1
  22. package/dist/qmetry/types/testcase.js +2 -1
  23. package/dist/qmetry/types/udf.js +5 -12
  24. package/dist/swagger/client/api.js +29 -4
  25. package/dist/swagger/client/functional-testing-api.js +17 -10
  26. package/dist/swagger/client/functional-testing-tools.js +1 -1
  27. package/dist/swagger/client/functional-testing-types.js +65 -2
  28. package/dist/swagger/client/functional-testing-url-utils.js +110 -0
  29. package/dist/swagger/client/registry-types.js +2 -2
  30. package/dist/swagger/client/tools.js +2 -2
  31. package/dist/zephyr/client.js +2 -0
  32. package/dist/zephyr/common/rest-api-schemas.js +345 -4
  33. package/dist/zephyr/tool/folder/get-folders.js +69 -0
  34. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const version = "0.39.0";
1
+ const version = "0.40.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
  },
@@ -1,6 +1,129 @@
1
1
  import { QMetryToolsHandlers } from "../../config/constants.js";
2
- import { RequirementListArgsSchema, RequirementDetailsArgsSchema, LinkRequirementToTestCaseArgsSchema, TestCasesLinkedToRequirementArgsSchema, RequirementsLinkedToTestCaseArgsSchema } from "../../types/common.js";
2
+ import { CreateRequirementArgsSchema, UpdateRequirementArgsSchema, RequirementListArgsSchema, RequirementDetailsArgsSchema, LinkRequirementToTestCaseArgsSchema, TestCasesLinkedToRequirementArgsSchema, RequirementsLinkedToTestCaseArgsSchema } from "../../types/common.js";
3
3
  const REQUIREMENT_TOOLS = [
4
+ {
5
+ title: "Create Requirement",
6
+ toolset: "Requirements",
7
+ summary: "Create a new requirement in QMetry with metadata and release/cycle mapping.",
8
+ handler: QMetryToolsHandlers.CREATE_REQUIREMENT,
9
+ inputSchema: CreateRequirementArgsSchema,
10
+ purpose: "Allows users to create a new requirement in QMetry, including custom fields (UDFs), and release/cycle mapping. For fields like requirementOwner, requirementState, etc., fetch their valid values using the project info tool. If rqFolderId is not provided, it will be auto-resolved to the root requirement folder using project info. HARD GATE: if the project is Jira-integrated or Azure-integrated and the Requirement module is configured to sync with that external system, this tool refuses to create the requirement in QMetry",
11
+ useCases: [
12
+ "Create a basic requirement with just a name",
13
+ "Add detailed metadata like priority, component, and description to a requirement",
14
+ "Associate a requirement with a specific release/cycle for planning",
15
+ "Set requirementOwner and requirementState using valid IDs from project info",
16
+ "Create a requirement in a specific folder using rqFolderId",
17
+ "Set custom fields (UDFs) values on the new requirement"
18
+ ],
19
+ examples: [
20
+ {
21
+ description: "Create a requirement in the root folder (auto-resolved)",
22
+ parameters: {
23
+ name: "New login requirement"
24
+ },
25
+ expectedOutput: "Requirement created in the root requirement folder with ID and summary details"
26
+ },
27
+ {
28
+ description: "Create a requirement with metadata",
29
+ parameters: {
30
+ name: "New login requirement",
31
+ priority: 688864,
32
+ component: [689030],
33
+ requirementOwner: 8,
34
+ requirementState: 688912,
35
+ description: "Users must be able to log in with SSO.",
36
+ associateRelCyc: true,
37
+ releaseCycleMapping: [
38
+ { release: 1628, cycle: [1839, 1840], version: 1 }
39
+ ]
40
+ },
41
+ expectedOutput: "Requirement created with metadata. Example uses: priority=688864, component=[689030], requirementOwner=8, requirementState=688912 — resolve these IDs from project info's customListObjs before use."
42
+ }
43
+ ],
44
+ hints: [
45
+ "'name' is the only mandatory field — sets the requirement's title/summary. Every other field is optional.",
46
+ "'description' is a free-text field (supports HTML) for detailed requirement information.",
47
+ "'component' is an array of Component (Label) IDs — resolve names to IDs from project info before use.",
48
+ "If rqFolderId is not provided, it will be auto-resolved to the root requirement folder using project info (rootFolders.RQ.id).",
49
+ "To get valid values for priority, component, requirementOwner (owner), requirementState (state), call the 'Admin/Get info Service' API (FETCH_PROJECT_INFO tool) and use the returned customListObjs IDs.",
50
+ "If the user provides a name instead of an ID for owner/state/priority/component, fetch project info, find the matching entry by name in the relevant customListObjs list, and use its ID. If not found, skip that field and tell the user it was omitted because the value wasn't available in the current project.",
51
+ "Release/cycle mapping is optional. If the user wants to associate a release and cycle, set associateRelCyc: true and provide releaseCycleMapping.",
52
+ "HARD GATE (not configurable): before creating, this tool checks project info for isExtTrackerConfigured, extTrackerType, and isRQConfigured. If the project has an external tracker configured (isExtTrackerConfigured=true) and isRQConfigured=true, and the tracker is Jira (extTrackerType=1) or Azure (extTrackerType=3), the create is refused with an error — do NOT retry or work around this. Tell the user requirements for this project must be created directly in the external system (Jira or Azure), then synced into QMetry.",
53
+ "",
54
+ "UDF (User Defined Fields) WORKFLOW FOR CREATE:",
55
+ "1. Call 'Fetch UDF Layout' with entityType='RQ', pageName='ADD' to discover field names, types, and list option IDs.",
56
+ " IF listOptions[field.listName] is empty after Fetch UDF Layout, the tool already tried a metadata fallback. If STILL empty, ask the user to provide the option ID from the QMetry UI — do NOT guess numeric IDs.",
57
+ "2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
58
+ "3. For MULTILOOKUPLIST fields: pick an array of IDs.",
59
+ "4. For CASCADINGLIST fields: pick parent ID, then call 'Fetch Cascade Child Values' for child ID. Pass { parent: parentId, child: childId }.",
60
+ "5. Pass all UDF values via 'udfFields' param: { fieldName: value }.",
61
+ "6. Mandatory UDF fields (isMandatory=true) MUST be included or create will fail."
62
+ ],
63
+ outputDescription: "JSON object containing the new requirement ID, summary, and creation metadata.",
64
+ readOnly: false,
65
+ idempotent: false
66
+ },
67
+ {
68
+ title: "Update Requirement",
69
+ toolset: "Requirements",
70
+ summary: "Update an existing QMetry requirement by rqId and rqVersionId.",
71
+ handler: QMetryToolsHandlers.UPDATE_REQUIREMENT,
72
+ inputSchema: UpdateRequirementArgsSchema,
73
+ purpose: "Update a QMetry requirement's priority, or custom field (UDF) values. Can also create new versions.Requires rqId and rqVersionId, which can be auto-resolved from the requirement entityKey using the requirement list and version detail tools.Only fields provided will be updated.HARD GATE: if the project is Jira-integrated or Azure-integrated and the Requirement module is configured to sync with that external system, this tool refuses to update the requirement in QMetry — it must be updated in the external system instead.",
74
+ useCases: [
75
+ "Update the name, description, priority, owner, state, or component of a requirement",
76
+ "Add or remove attachments on a requirement",
77
+ "Update custom field (UDF) values on a requirement",
78
+ "Create a new version of a requirement while updating it (updateWithVersion)"
79
+ ],
80
+ examples: [
81
+ {
82
+ description: "Update the priority of a requirement",
83
+ parameters: {
84
+ rqId: 2073,
85
+ rqVersionId: 2087,
86
+ updateWithVersion: false,
87
+ priority: 688865
88
+ },
89
+ expectedOutput: "Requirement priority updated successfully."
90
+ },
91
+ {
92
+ description: "Update name, description, owner, and state",
93
+ parameters: {
94
+ rqId: 2073,
95
+ rqVersionId: 2087,
96
+ name: "Updated login requirement",
97
+ description: "Users must be able to log in with SSO.",
98
+ requirementOwner: 8,
99
+ requirementState: 688912,
100
+ component: [689030]
101
+ },
102
+ expectedOutput: "Requirement updated with new name, description, owner, state, and component."
103
+ }
104
+ ],
105
+ hints: [
106
+ "If the user provides an entityKey (e.g., MAC-RQ-730), first call 'Fetch Requirements' with a filter on entityKeyId to resolve rqId and rqVersionId.",
107
+ "updateWithVersion: pass 'true' to create a new version of the requirement instead of updating the current version in place.",
108
+ "To get valid values for priority, requirementOwner, requirementState, and component, call the 'Admin/Get info Service' API (FETCH_PROJECT_INFO tool) and use the returned customListObjs IDs.",
109
+ "If the user provides a name instead of an ID for owner/state/priority, fetch project info, find the matching entry by name in the relevant customListObjs list, and use its ID. If not found, skip that field and tell the user it was omitted because the value wasn't available in the current project.",
110
+ "attachments (if used) requires both ADD and REMOVE arrays — pass empty arrays when there is nothing to add or remove.",
111
+ "Only fields explicitly listed in this tool's parameters are supported — releaseCycleMapping and associateRelCyc are create-only and not supported here.",
112
+ "HARD GATE: before updating, this tool checks project info for isExtTrackerConfigured, extTrackerType, and isRQConfigured. If the project has an external tracker configured (isExtTrackerConfigured=true) and isRQConfigured=true, and the tracker is Jira (extTrackerType=1) or Azure (extTrackerType=3), the update is refused with an error — do NOT retry or work around this. Tell the user requirements for this project must be updated directly in the external system (Jira or Azure), then synced into QMetry.",
113
+ "",
114
+ "UDF (User Defined Fields) WORKFLOW FOR UPDATE:",
115
+ "1. Call 'Fetch UDF Layout' with entityType='RQ', pageName='DETAIL' to get field names, fieldIDs (projectUserFieldID), and list option IDs.",
116
+ " IF listOptions[field.listName] is empty after Fetch UDF Layout, the tool already tried a metadata fallback. If STILL empty, ask the user to provide the option ID from the QMetry UI — do NOT guess numeric IDs.",
117
+ "2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
118
+ "3. For MULTILOOKUPLIST fields: pick array of IDs; also pass alias flat key (e.g., fieldNameAlias: 'Option Label').",
119
+ "4. For CASCADINGLIST fields: pick parent ID + fetch child with 'Fetch Cascade Child Values'. Pass { parent: parentId, child: childId }.",
120
+ "5. Pass BOTH 'udfFields' (flat root values) AND 'UDF' wrapper (with fieldID) — both required for update. Example: udfFields: { rq_field: 'value' }, UDF: { rq_field: { fieldID: 2001, value: 'value' } }",
121
+ "6. Mandatory UDF fields (isMandatory=true) MUST be included."
122
+ ],
123
+ outputDescription: "JSON object containing the updated requirement ID, summary, and update metadata.",
124
+ readOnly: false,
125
+ idempotent: false
126
+ },
4
127
  {
5
128
  title: "Fetch Requirements",
6
129
  toolset: "Requirements",
@@ -27,16 +150,6 @@ const REQUIREMENT_TOOLS = [
27
150
  parameters: { projectKey: "UT" },
28
151
  expectedOutput: "List of requirements from UT project using UT's specific RQ viewId"
29
152
  },
30
- {
31
- description: "Get requirements with manual viewId (skip auto-resolution)",
32
- parameters: {
33
- projectKey: "MAC",
34
- viewId: 7397,
35
- // This is an example viewId, must be resolved per project RQ viewId
36
- folderPath: "/APIARY 88"
37
- },
38
- expectedOutput: "Requirements using manually specified viewId 7397"
39
- },
40
153
  {
41
154
  description: "Search for specific requirements by entity key",
42
155
  parameters: {