@smartbear/mcp 0.42.0 → 0.43.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 (47) hide show
  1. package/dist/bearq/api.js +16 -0
  2. package/dist/bearq/client.js +9 -1
  3. package/dist/bearq/tool/tasks/stop-task.js +6 -3
  4. package/dist/bearq/tool/workflows/get-workflow-run.js +31 -0
  5. package/dist/bearq/tool/workflows/list-workflows.js +28 -0
  6. package/dist/bearq/tool/workflows/run-workflow.js +57 -0
  7. package/dist/bearq/tool/workflows/stop-workflow-run.js +33 -0
  8. package/dist/common/transport-http.js +8 -1
  9. package/dist/package.json.js +1 -1
  10. package/dist/pactflow/client/admin-api.js +3 -8
  11. package/dist/pactflow/client/ai.js +34 -0
  12. package/dist/pactflow/client/contract-api.js +2 -0
  13. package/dist/pactflow/client/http-client.js +7 -2
  14. package/dist/pactflow/client/pacticipant-api.js +37 -0
  15. package/dist/pactflow/client/schemas/admin.js +799 -0
  16. package/dist/pactflow/client/schemas/common.js +201 -0
  17. package/dist/pactflow/client/schemas/contract.js +444 -0
  18. package/dist/pactflow/client/schemas/environment.js +94 -0
  19. package/dist/pactflow/client/schemas/output.js +55 -0
  20. package/dist/pactflow/client/schemas/pacticipant.js +290 -0
  21. package/dist/pactflow/client/schemas/webhook.js +164 -0
  22. package/dist/pactflow/client/tools.js +32 -1
  23. package/dist/pactflow/client.js +21 -3
  24. package/dist/qmetry/client/ai-agent.js +3 -0
  25. package/dist/qmetry/client/api/error-handler.js +7 -2
  26. package/dist/qmetry/client/auto-resolve.js +5 -0
  27. package/dist/qmetry/client/handlers.js +2 -1
  28. package/dist/qmetry/client/project.js +19 -1
  29. package/dist/qmetry/client/testsuite.js +207 -2
  30. package/dist/qmetry/client/tools/ai-agent-tools.js +13 -0
  31. package/dist/qmetry/client/tools/issue-tools.js +7 -3
  32. package/dist/qmetry/client/tools/project-tools.js +34 -1
  33. package/dist/qmetry/client/tools/testcase-tools.js +43 -296
  34. package/dist/qmetry/client/tools/testsuite-tools.js +49 -19
  35. package/dist/qmetry/client/udf.js +14 -2
  36. package/dist/qmetry/client.js +2 -1
  37. package/dist/qmetry/config/constants.js +1 -0
  38. package/dist/qmetry/config/rest-endpoints.js +2 -1
  39. package/dist/qmetry/types/ai-agent.js +3 -0
  40. package/dist/qmetry/types/common.js +40 -2
  41. package/dist/qmetry/types/udf.js +1 -20
  42. package/dist/swagger/client/portal-types.js +11 -5
  43. package/dist/swagger/client/registry-types.js +5 -4
  44. package/dist/swagger/client/tools.js +1 -1
  45. package/package.json +2 -2
  46. package/plugin/README.md +42 -0
  47. package/dist/pactflow/client/base.js +0 -488
@@ -10,6 +10,7 @@ import { HttpClient } from "./client/http-client.js";
10
10
  import { PacticipantApi } from "./client/pacticipant-api.js";
11
11
  import { withPagination } from "./client/pagination.js";
12
12
  import { PROMPTS } from "./client/prompts.js";
13
+ import { PACTFLOW_OUTPUT_SCHEMAS, advisoryOutputSchema, withPaginationOutput } from "./client/schemas/output.js";
13
14
  import { TOOLS } from "./client/tools.js";
14
15
  import { WebhookApi } from "./client/webhook-api.js";
15
16
  const ConfigurationSchema = zod__default.object({
@@ -121,7 +122,12 @@ class PactflowClient {
121
122
  continue;
122
123
  }
123
124
  const { handler, clients: _, formatResponse, ...toolParams } = tool;
124
- register(toolParams, async (args, _ctx) => {
125
+ const handlerSchema = PACTFLOW_OUTPUT_SCHEMAS[handler];
126
+ const outputSchema = advisoryOutputSchema(
127
+ tool.paginated ? withPaginationOutput(handlerSchema) : handlerSchema,
128
+ tool.title
129
+ );
130
+ register({ ...toolParams, outputSchema }, async (args, _ctx) => {
125
131
  const handler_fn = this.handlerMap[handler];
126
132
  if (typeof handler_fn !== "function") {
127
133
  throw new Error(`Handler '${handler}' not found on PactClient`);
@@ -143,11 +149,15 @@ class PactflowClient {
143
149
  } else {
144
150
  result = await handler_fn(args);
145
151
  }
152
+ const structuredContent = toStructuredContent(result);
146
153
  if (formatResponse) {
147
- return formatResponse(result);
154
+ return { structuredContent, ...formatResponse(result) };
148
155
  }
149
156
  return {
150
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
157
+ content: [
158
+ { type: "text", text: JSON.stringify(structuredContent, null, 2) }
159
+ ],
160
+ structuredContent
151
161
  };
152
162
  });
153
163
  }
@@ -165,6 +175,14 @@ class PactflowClient {
165
175
  }
166
176
  }
167
177
  }
178
+ function toStructuredContent(result) {
179
+ if (result === void 0) return { success: true };
180
+ if (result === null) return {};
181
+ if (typeof result === "object" && !Array.isArray(result)) {
182
+ return result;
183
+ }
184
+ return { result };
185
+ }
168
186
  export {
169
187
  PactflowClient
170
188
  };
@@ -59,6 +59,9 @@ async function executeGateReport(token, baseUrl, project, payload) {
59
59
  if (payload.cycleIds !== void 0) {
60
60
  body.cycleIds = payload.cycleIds;
61
61
  }
62
+ if (payload.extKeys !== void 0) {
63
+ body.extKeys = payload.extKeys;
64
+ }
62
65
  if (payload.page !== void 0) {
63
66
  body.page = payload.page;
64
67
  }
@@ -221,11 +221,16 @@ function createQMetryError(context) {
221
221
  async function handleQMetryApiError(response, baseUrl, project, path) {
222
222
  let errorData;
223
223
  let errorText;
224
+ let rawBody = "";
224
225
  try {
225
- errorData = await response.json();
226
+ rawBody = await response.text();
227
+ } catch {
228
+ }
229
+ try {
230
+ errorData = JSON.parse(rawBody);
226
231
  errorText = JSON.stringify(errorData);
227
232
  } catch {
228
- errorText = await response.text() || `HTTP ${response.status}`;
233
+ errorText = rawBody || `HTTP ${response.status}`;
229
234
  }
230
235
  const context = {
231
236
  status: response.status,
@@ -44,6 +44,11 @@ const AUTO_RESOLVE_MODULES = [
44
44
  viewIdPath: "latestViews.TE.viewId",
45
45
  moduleName: "Test Run UDF Values"
46
46
  },
47
+ {
48
+ handler: QMetryToolsHandlers.BULK_UPDATE_EXECUTION_STATUS,
49
+ viewIdPath: "latestViews.TE.viewId",
50
+ moduleName: "Bulk Update Test Case Execution Status"
51
+ },
47
52
  {
48
53
  handler: QMetryToolsHandlers.FETCH_EXECUTIONS_BY_TESTSUITE,
49
54
  viewIdPath: "latestViews.TEL.viewId",
@@ -2,7 +2,7 @@ import { QMetryToolsHandlers } from "../config/constants.js";
2
2
  import { exportHtmlReport, executeGateReport, getGateConfiguration } from "./ai-agent.js";
3
3
  import { getAutomationStatus, importAutomationResults } from "./automation.js";
4
4
  import { fetchIssueExecutions, linkIssuesToTestcaseRun, fetchIssueDetails, fetchIssues, updateIssue, createIssue, fetchIssuesLinkedToTestCase } from "./issues.js";
5
- import { updateCycle, createCycle, createRelease, getPlatforms, getBuilds, getReleasesCycles, getProjectInfo, getProjects } from "./project.js";
5
+ import { updateCycle, createCycle, createRelease, getApiQuotaStatus, getPlatforms, getBuilds, getReleasesCycles, getProjectInfo, getProjects } from "./project.js";
6
6
  import { fetchRequirementsLinkedToTestCase, fetchRequirementDetails, fetchRequirements, updateRequirement, createRequirement } from "./requirement.js";
7
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";
@@ -14,6 +14,7 @@ const QMETRY_HANDLER_MAP = {
14
14
  [QMetryToolsHandlers.FETCH_RELEASES_CYCLES]: getReleasesCycles,
15
15
  [QMetryToolsHandlers.FETCH_BUILDS]: getBuilds,
16
16
  [QMetryToolsHandlers.FETCH_PLATFORMS]: getPlatforms,
17
+ [QMetryToolsHandlers.FETCH_API_QUOTA_STATUS]: getApiQuotaStatus,
17
18
  [QMetryToolsHandlers.CREATE_RELEASE]: createRelease,
18
19
  [QMetryToolsHandlers.CREATE_CYCLE]: createCycle,
19
20
  [QMetryToolsHandlers.UPDATE_CYCLE]: updateCycle,
@@ -51,7 +51,6 @@ const PROJECT_FIELDS_TO_OMIT = /* @__PURE__ */ new Set([
51
51
  "isTestSuiteApprover",
52
52
  "isTestSuiteCloser",
53
53
  "isRequirementReviewer",
54
- "isApprovalWorkflowEnabled",
55
54
  "isPartLevelComplianceEnabled",
56
55
  "isAutoApproveTestRunEnabled",
57
56
  "isDeriveTCRStatusFromTCSRStatus",
@@ -174,6 +173,24 @@ async function getPlatforms(token, baseUrl, project, payload) {
174
173
  body
175
174
  });
176
175
  }
176
+ async function getApiQuotaStatus(token, baseUrl, project, _payload = {}) {
177
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
178
+ baseUrl,
179
+ project
180
+ );
181
+ return qmetryRequest({
182
+ method: "GET",
183
+ path: QMETRY_PATHS.PROJECT.GET_API_QUOTA_STATUS,
184
+ token,
185
+ baseUrl: resolvedBaseUrl,
186
+ project: resolvedProject,
187
+ // The quota endpoint expects the literal "default" scope, not a numeric project scope.
188
+ extraHeaders: {
189
+ scope: "default",
190
+ "Content-Type": "application/json"
191
+ }
192
+ });
193
+ }
177
194
  async function createRelease(token, baseUrl, project, payload) {
178
195
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
179
196
  baseUrl,
@@ -257,6 +274,7 @@ async function updateCycle(token, baseUrl, project, payload) {
257
274
  export {
258
275
  createCycle,
259
276
  createRelease,
277
+ getApiQuotaStatus,
260
278
  getBuilds,
261
279
  getPlatforms,
262
280
  getProjectInfo,
@@ -1,6 +1,8 @@
1
1
  import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
+ import { DEFAULT_PAGINATION } from "../types/common.js";
2
3
  import { DEFAULT_LINKED_PLATFORMS_TO_TESTSUITE_PAYLOAD, DEFAULT_FETCH_LINKED_ISSUES_BY_TESTCASE_RUN_PAYLOAD, DEFAULT_FETCH_TESTCASE_RUNS_BY_TESTSUITE_RUN_PAYLOAD, DEFAULT_BULK_UPDATE_EXECUTION_STATUS_PAYLOAD, DEFAULT_FETCH_EXECUTIONS_BY_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTCASES_BY_TESTSUITE_PAYLOAD, DEFAULT_REQLINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_LINKED_TESTCASE_TO_TESTSUITE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_FOR_TESTCASE_PAYLOAD, DEFAULT_FETCH_TESTSUITES_PAYLOAD, DEFAULT_UPDATE_TESTSUITE_PAYLOAD, DEFAULT_CREATE_TESTSUITE_PAYLOAD } from "../types/testsuite.js";
3
4
  import { qmetryRequest } from "./api/client-api.js";
5
+ import { fetchTestRunUdfMetadata, parseRawUdfs, bulkUpdateTestRunUdfs, stripHtml } from "./udf.js";
4
6
  import { resolveDefaults } from "./utils.js";
5
7
  async function createTestSuites(token, baseUrl, project, payload) {
6
8
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
@@ -344,14 +346,217 @@ async function bulkUpdateExecutionStatus(token, baseUrl, project, payload) {
344
346
  "[bulkUpdateExecutionStatus] Missing or invalid required parameter: 'runStatusID'. It must be a number."
345
347
  );
346
348
  }
347
- return qmetryRequest({
349
+ const {
350
+ viewId,
351
+ udfValuesByRun,
352
+ scopeId,
353
+ orgCode,
354
+ folderPath: _folderPath,
355
+ ...statusBody
356
+ } = body;
357
+ let udfUpdates = [];
358
+ if (statusBody.entityType === "TCSR") {
359
+ if (udfValuesByRun && Object.keys(udfValuesByRun).length > 0) {
360
+ throw new Error(
361
+ "[bulkUpdateExecutionStatus] 'udfValuesByRun' is only supported when entityType is 'TCR'. Test Run UDFs belong to Test Case Runs, not Test Case Step Runs."
362
+ );
363
+ }
364
+ } else {
365
+ const gate = await applyMandatoryTestRunUdfGate(
366
+ token,
367
+ resolvedBaseUrl,
368
+ resolvedProject,
369
+ {
370
+ tcRunIDs: statusBody.entityIDs.split(",").map((id) => id.trim()).filter(Boolean),
371
+ qmTsRunId: statusBody.qmTsRunId,
372
+ viewId,
373
+ udfValuesByRun,
374
+ scopeId,
375
+ orgCode
376
+ }
377
+ );
378
+ if (gate.blocked) {
379
+ return gate.blocked;
380
+ }
381
+ udfUpdates = gate.udfUpdates;
382
+ }
383
+ const statusUpdate = await qmetryRequest({
348
384
  method: "PUT",
349
385
  path: QMETRY_PATHS.TESTSUITE.BULK_UPDATE_EXECUTION_STATUS,
350
386
  token,
351
387
  project: resolvedProject,
352
388
  baseUrl: resolvedBaseUrl,
353
- body
389
+ body: statusBody
390
+ });
391
+ return { success: true, udfUpdates, statusUpdate };
392
+ }
393
+ const TEST_RUN_UDF_GATE_PAGE_SIZE = DEFAULT_PAGINATION.limit;
394
+ function isEmptyUdfValue(value) {
395
+ return value === null || value === void 0 || typeof value === "string" && stripHtml(value).trim().length === 0 || Array.isArray(value) && value.length === 0;
396
+ }
397
+ async function applyMandatoryTestRunUdfGate(token, baseUrl, project, args) {
398
+ const { tcRunIDs, qmTsRunId, viewId, scopeId, orgCode } = args;
399
+ const udfValuesByRun = args.udfValuesByRun ?? {};
400
+ const metadata = await fetchTestRunUdfMetadata(token, baseUrl, project, {
401
+ scopeId,
402
+ orgCode
354
403
  });
404
+ const fieldsByName = new Map(metadata.fields.map((f) => [f.name, f]));
405
+ const unknownRuns = Object.keys(udfValuesByRun).filter(
406
+ (id) => !tcRunIDs.includes(id)
407
+ );
408
+ if (unknownRuns.length > 0) {
409
+ throw new Error(
410
+ `[bulkUpdateExecutionStatus] 'udfValuesByRun' contains tcRunIDs that are not in 'entityIDs': ${unknownRuns.join(", ")}.`
411
+ );
412
+ }
413
+ for (const [tcRunID, udfs] of Object.entries(udfValuesByRun)) {
414
+ const unknownFields = Object.keys(udfs).filter(
415
+ (name) => !fieldsByName.has(name)
416
+ );
417
+ if (unknownFields.length > 0) {
418
+ throw new Error(
419
+ `[bulkUpdateExecutionStatus] 'udfValuesByRun.${tcRunID}' contains unknown Test Run UDF field names: ${unknownFields.join(", ")}. Valid names: ${[...fieldsByName.keys()].join(", ") || "(none)"}.`
420
+ );
421
+ }
422
+ const mismatchedIDs = Object.entries(udfs).flatMap(([name, entry]) => {
423
+ const expected = fieldsByName.get(name)?.fieldID;
424
+ return entry.fieldID !== void 0 && entry.fieldID !== expected ? [`${name} (got ${entry.fieldID}, expected ${expected})`] : [];
425
+ });
426
+ if (mismatchedIDs.length > 0) {
427
+ throw new Error(
428
+ `[bulkUpdateExecutionStatus] 'udfValuesByRun.${tcRunID}' contains fieldIDs that do not match the Test Run UDF metadata: ${mismatchedIDs.join(", ")}. Omit fieldID to have it filled in automatically.`
429
+ );
430
+ }
431
+ }
432
+ const mandatoryFields = metadata.fields.filter((f) => f.allowBlank === false);
433
+ if (mandatoryFields.length > 0) {
434
+ if (typeof viewId !== "number") {
435
+ throw new Error(
436
+ "[bulkUpdateExecutionStatus] Missing or invalid parameter: 'viewId'. It is required to verify mandatory Test Run UDFs (latestViews.TE.viewId from project info)."
437
+ );
438
+ }
439
+ const rowsById = await fetchTestCaseRunRows(token, baseUrl, project, {
440
+ tcRunIDs,
441
+ qmTsRunId,
442
+ viewId,
443
+ scopeId,
444
+ orgCode
445
+ });
446
+ const notFound = tcRunIDs.filter((id) => !rowsById.has(id));
447
+ if (notFound.length > 0) {
448
+ throw new Error(
449
+ `[bulkUpdateExecutionStatus] tcRunID(s) ${notFound.join(", ")} not found in test suite run ${qmTsRunId}.`
450
+ );
451
+ }
452
+ const runsMissingFields = tcRunIDs.flatMap((tcRunID) => {
453
+ const row = rowsById.get(tcRunID);
454
+ const current = parseRawUdfs(row);
455
+ const supplied = udfValuesByRun[tcRunID] ?? {};
456
+ const missingFields = mandatoryFields.filter(
457
+ (f) => isEmptyUdfValue(
458
+ f.name in supplied ? supplied[f.name]?.value : current[f.name]
459
+ )
460
+ ).map((f) => ({
461
+ name: f.name,
462
+ label: f.label,
463
+ fieldID: f.fieldID,
464
+ fieldType: f.fieldType,
465
+ ...f.listName ? { listName: f.listName } : {}
466
+ }));
467
+ return missingFields.length > 0 ? [
468
+ {
469
+ tcRunID: Number(tcRunID),
470
+ entityKey: row.entityKey,
471
+ missingFields
472
+ }
473
+ ] : [];
474
+ });
475
+ if (runsMissingFields.length > 0) {
476
+ return {
477
+ blocked: {
478
+ success: false,
479
+ code: "MANDATORY_TEST_RUN_UDF_MISSING",
480
+ statusUpdated: false,
481
+ message: `Execution status was NOT updated: ${runsMissingFields.length} Test Case Run(s) are missing mandatory Test Run UDF values. No UDF values or statuses were changed.`,
482
+ runsMissingFields,
483
+ ...Object.keys(metadata.lookupOptions).length > 0 ? { lookupOptions: metadata.lookupOptions } : {},
484
+ _note: "Ask the user for the missing values, then retry with 'udfValuesByRun' keyed by tcRunID and UDF field name. Lookup fields take option 'id' values from lookupOptions[listName]; dates use MM-DD-YYYY."
485
+ }
486
+ };
487
+ }
488
+ }
489
+ const groups = /* @__PURE__ */ new Map();
490
+ for (const [tcRunID, udfs] of Object.entries(udfValuesByRun)) {
491
+ const names = Object.keys(udfs).sort();
492
+ if (names.length === 0) continue;
493
+ const UDF = {};
494
+ for (const name of names) {
495
+ const entry = udfs[name];
496
+ UDF[name] = {
497
+ fieldID: fieldsByName.get(name)?.fieldID,
498
+ value: entry.value,
499
+ ...entry.multiSelectAction ? { multiSelectAction: entry.multiSelectAction } : {}
500
+ };
501
+ }
502
+ const key = JSON.stringify(UDF);
503
+ const group = groups.get(key);
504
+ if (group) {
505
+ group.tcRunIDs.push(Number(tcRunID));
506
+ } else {
507
+ groups.set(key, { tcRunIDs: [Number(tcRunID)], UDF });
508
+ }
509
+ }
510
+ const udfUpdates = [];
511
+ for (const group of groups.values()) {
512
+ try {
513
+ const response = await bulkUpdateTestRunUdfs(token, baseUrl, project, {
514
+ tcRunIDs: group.tcRunIDs,
515
+ UDF: group.UDF,
516
+ scopeId,
517
+ orgCode
518
+ });
519
+ udfUpdates.push({ tcRunIDs: group.tcRunIDs, response });
520
+ } catch (err) {
521
+ const applied = udfUpdates.flatMap((u) => u.tcRunIDs);
522
+ throw new Error(
523
+ `[bulkUpdateExecutionStatus] Test Run UDF update failed for tcRunIDs ${group.tcRunIDs.join(", ")}; execution status was NOT updated. UDF updates already applied for tcRunIDs: ${applied.length > 0 ? applied.join(", ") : "(none)"}. Error: ${err instanceof Error ? err.message : String(err)}`
524
+ );
525
+ }
526
+ }
527
+ return { udfUpdates };
528
+ }
529
+ async function fetchTestCaseRunRows(token, baseUrl, project, args) {
530
+ const wanted = new Set(args.tcRunIDs);
531
+ const rowsById = /* @__PURE__ */ new Map();
532
+ let start = 0;
533
+ while (rowsById.size < wanted.size) {
534
+ const response = await qmetryRequest({
535
+ method: "POST",
536
+ path: QMETRY_PATHS.TESTSUITE.GET_TESTCASE_RUNS_BY_TESTSUITE_RUN,
537
+ token,
538
+ project,
539
+ baseUrl,
540
+ body: {
541
+ tsrunID: args.qmTsRunId,
542
+ viewId: args.viewId,
543
+ start,
544
+ page: 1,
545
+ limit: TEST_RUN_UDF_GATE_PAGE_SIZE
546
+ },
547
+ scopeId: args.scopeId,
548
+ orgCode: args.orgCode
549
+ });
550
+ const data = Array.isArray(response?.data) ? response.data : [];
551
+ for (const row of data) {
552
+ const id = String(row.tcRunID);
553
+ if (wanted.has(id)) rowsById.set(id, row);
554
+ }
555
+ start += data.length;
556
+ const total = typeof response?.total === "number" ? response.total : 0;
557
+ if (data.length === 0 || start >= total) break;
558
+ }
559
+ return rowsById;
355
560
  }
356
561
  async function fetchTestSuiteDetails(token, baseUrl, project, payload) {
357
562
  const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
@@ -44,6 +44,7 @@ const AI_AGENT_TOOLS = [
44
44
  "Generate a release readiness report for a specific project, release, and cycle",
45
45
  "Execute a quality gate assessment to evaluate project health against gate criteria",
46
46
  "Run a gate report scoped to specific cycles within a release",
47
+ "Run a gate report scoped to specific external (e.g. Jira) issue keys",
47
48
  "Produce analytics data for quality gate evaluation and decision-making"
48
49
  ],
49
50
  examples: [
@@ -58,6 +59,17 @@ const AI_AGENT_TOOLS = [
58
59
  },
59
60
  expectedOutput: '{ "data": [...], "total": 0, "success": true, "page": {} }'
60
61
  },
62
+ {
63
+ description: "Execute a gate report scoped to specific external issue keys",
64
+ parameters: {
65
+ reportName: "RR",
66
+ gateIdentifier: "GATE1",
67
+ projectId: 45851,
68
+ releaseId: 90698,
69
+ extKeys: ["PROJ-101", "PROJ-102"]
70
+ },
71
+ expectedOutput: '{ "data": [...], "total": 0, "success": true, "page": {} }'
72
+ },
61
73
  {
62
74
  description: "Execute a gate report without release/cycle scoping",
63
75
  parameters: {
@@ -74,6 +86,7 @@ const AI_AGENT_TOOLS = [
74
86
  "REQUIRED: 'projectId' must be a valid numeric project ID.",
75
87
  "OPTIONAL: 'releaseId' scopes the report to a specific release.",
76
88
  "OPTIONAL: 'cycleIds' scopes the report to specific test cycles within the release.",
89
+ "OPTIONAL: 'extKeys' scopes the report to specific external issue keys (e.g. Jira keys like 'PROJ-123').",
77
90
  "OPTIONAL: 'page' specifies the page number for paginated report results.",
78
91
  "OPTIONAL: 'limit' sets the maximum number of records per page (defaults to 100).",
79
92
  "Call 'Fetch Quality Gate Configuration' first to discover available gates and report parameters.",
@@ -265,9 +265,13 @@ const ISSUE_TOOLS = [
265
265
  expectedOutput: "Issue type updated successfully."
266
266
  },
267
267
  {
268
- description: "Update affected release",
269
- parameters: { DefectId: 118150, affectedRelease: 3730 },
270
- expectedOutput: "Affected release updated successfully."
268
+ description: "Update affected release and affected cycles",
269
+ parameters: {
270
+ DefectId: 118150,
271
+ affectedRelease: 3730,
272
+ affectedCycles: [1168]
273
+ },
274
+ expectedOutput: "Affected release and affected cycles updated successfully."
271
275
  }
272
276
  ],
273
277
  hints: [
@@ -1,5 +1,5 @@
1
1
  import { QMetryToolsHandlers } from "../../config/constants.js";
2
- import { ProjectListArgsSchema, ProjectArgsSchema, ReleasesCyclesArgsSchema, BuildArgsSchema, PlatformArgsSchema, CreateReleaseArgsSchema, CreateCycleArgsSchema, UpdateCycleArgsSchema } from "../../types/common.js";
2
+ import { ProjectListArgsSchema, ProjectArgsSchema, ReleasesCyclesArgsSchema, BuildArgsSchema, PlatformArgsSchema, ApiQuotaStatusArgsSchema, CreateReleaseArgsSchema, CreateCycleArgsSchema, UpdateCycleArgsSchema } from "../../types/common.js";
3
3
  const PROJECT_TOOLS = [
4
4
  {
5
5
  title: "Fetch QMetry list Projects",
@@ -348,6 +348,39 @@ const PROJECT_TOOLS = [
348
348
  idempotent: true,
349
349
  openWorld: false
350
350
  },
351
+ {
352
+ title: "Fetch API Call Quota",
353
+ toolset: "Projects",
354
+ summary: "Fetch the hourly and daily QMetry Open API call limits, calls consumed, calls remaining, and reset times",
355
+ handler: QMetryToolsHandlers.FETCH_API_QUOTA_STATUS,
356
+ inputSchema: ApiQuotaStatusArgsSchema,
357
+ purpose: "Check the Open API call quota for the QMetry account behind the configured API key. Returns whether limits are enforced, plus the hourly and daily limit, consumed and remaining counts, and when each window resets. Calls to this tool do not count toward the quota.",
358
+ useCases: [
359
+ "Check how many API calls remain before running a large batch of operations",
360
+ "Diagnose rate-limit or quota-exceeded errors returned by other QMetry tools",
361
+ "Find out when the hourly or daily quota will reset",
362
+ "Confirm whether API call limits are enabled for the instance"
363
+ ],
364
+ examples: [
365
+ {
366
+ description: "Check the current API call quota",
367
+ parameters: {},
368
+ expectedOutput: "limitEnabled flag, hourly and daily { limit, consumed, remaining, resetsAt }, and serverTime"
369
+ }
370
+ ],
371
+ hints: [
372
+ "No parameters are needed — the quota belongs to the account/API key, not to a project",
373
+ "Calling this tool is free: it does not consume hourly or daily quota",
374
+ "If limitEnabled is false, no API call limits are enforced and the counts are informational only",
375
+ "resetsAt and serverTime are UTC ISO-8601 timestamps — compare resetsAt with serverTime, not with local time, to compute time until reset",
376
+ "Before a large batch of create/update/link calls, check hourly.remaining and daily.remaining and warn the user if the batch would exceed them",
377
+ "If another QMetry tool fails with a rate-limit or quota error, call this tool to report remaining calls and the reset time"
378
+ ],
379
+ outputDescription: "JSON object: limitEnabled (boolean), hourly and daily objects each with limit, consumed, remaining (numbers) and resetsAt (UTC timestamp), and serverTime (UTC timestamp)",
380
+ readOnly: true,
381
+ idempotent: true,
382
+ openWorld: false
383
+ },
351
384
  {
352
385
  title: "Create Release",
353
386
  toolset: "Projects",