@smartbear/mcp 0.35.0 → 0.37.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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/bearq/tool/tasks/wait-for-task.js +3 -3
  3. package/dist/bugsnag/client.js +1 -1
  4. package/dist/bugsnag/tool/error/get-error.js +1 -1
  5. package/dist/bugsnag/tool/error/list-project-errors.js +1 -1
  6. package/dist/bugsnag/tool/error/update-error.js +1 -1
  7. package/dist/bugsnag/tool/event/get-event-details-from-dashboard-url.js +1 -1
  8. package/dist/bugsnag/tool/event/get-event.js +1 -1
  9. package/dist/bugsnag/tool/event/list-error-events.js +1 -1
  10. package/dist/bugsnag/tool/performance/get-network-endpoint-groupings.js +1 -1
  11. package/dist/bugsnag/tool/performance/get-span-group.js +1 -1
  12. package/dist/bugsnag/tool/performance/get-trace.js +1 -1
  13. package/dist/bugsnag/tool/performance/list-span-groups.js +1 -1
  14. package/dist/bugsnag/tool/performance/list-spans.js +1 -1
  15. package/dist/bugsnag/tool/performance/list-trace-fields.js +1 -1
  16. package/dist/bugsnag/tool/performance/set-network-endpoint-groupings.js +1 -1
  17. package/dist/bugsnag/tool/project/get-current-project.js +1 -1
  18. package/dist/bugsnag/tool/project/list-project-event-filters.js +1 -1
  19. package/dist/bugsnag/tool/project/list-projects.js +1 -1
  20. package/dist/bugsnag/tool/release/get-build.js +1 -1
  21. package/dist/bugsnag/tool/release/get-release.js +1 -1
  22. package/dist/bugsnag/tool/release/list-releases.js +1 -1
  23. package/dist/collaborator/client.js +10 -10
  24. package/dist/common/server.js +11 -32
  25. package/dist/common/transport-http.js +5 -5
  26. package/dist/common/transport-stdio.js +1 -1
  27. package/dist/common/zod-utils.js +2 -1
  28. package/dist/package.json.js +1 -1
  29. package/dist/pactflow/client/base.js +8 -4
  30. package/dist/pactflow/client/tools.js +2 -2
  31. package/dist/pactflow/client.js +4 -4
  32. package/dist/qmetry/client/auto-resolve.js +5 -0
  33. package/dist/qmetry/client/date-utils.js +104 -0
  34. package/dist/qmetry/client/handlers.js +9 -5
  35. package/dist/qmetry/client/issues.js +124 -7
  36. package/dist/qmetry/client/testcase.js +36 -2
  37. package/dist/qmetry/client/testsuite.js +27 -2
  38. package/dist/qmetry/client/tools/issue-tools.js +202 -23
  39. package/dist/qmetry/client/tools/project-tools.js +14 -2
  40. package/dist/qmetry/client/tools/testcase-tools.js +275 -14
  41. package/dist/qmetry/client/tools/testsuite-tools.js +152 -5
  42. package/dist/qmetry/client/tools/udf-tools.js +83 -5
  43. package/dist/qmetry/client/udf.js +159 -4
  44. package/dist/qmetry/client.js +236 -1
  45. package/dist/qmetry/config/constants.js +5 -1
  46. package/dist/qmetry/config/rest-endpoints.js +7 -3
  47. package/dist/qmetry/types/common.js +113 -12
  48. package/dist/qmetry/types/testcase.js +1 -2
  49. package/dist/qmetry/types/udf.js +12 -1
  50. package/dist/reflect/tool/recording/connect-to-session.js +2 -2
  51. package/dist/swagger/client/api.js +96 -12
  52. package/dist/swagger/client/functional-testing-api.js +7 -1
  53. package/dist/swagger/client/functional-testing-tools.js +20 -17
  54. package/dist/swagger/client/functional-testing-types.js +184 -1
  55. package/dist/swagger/client/patch-spec-utils.js +31 -0
  56. package/dist/swagger/client/portal-types.js +1 -1
  57. package/dist/swagger/client/registry-types.js +44 -0
  58. package/dist/swagger/client/tools.js +11 -2
  59. package/dist/swagger/client/utils.js +8 -0
  60. package/dist/swagger/client.js +6 -2
  61. package/dist/zephyr/common/rest-api-schemas.js +3748 -3698
  62. package/dist/zephyr/tool/test-case/create-issue-link.js +4 -2
  63. package/dist/zephyr/tool/test-case/create-test-script.js +4 -2
  64. package/dist/zephyr/tool/test-case/create-test-steps.js +5 -1
  65. package/dist/zephyr/tool/test-case/get-test-steps.js +4 -2
  66. package/dist/zephyr/tool/test-case/update-test-case.js +3 -1
  67. package/dist/zephyr/tool/test-cycle/create-issue-link.js +4 -2
  68. package/dist/zephyr/tool/test-cycle/create-web-link.js +4 -2
  69. package/dist/zephyr/tool/test-cycle/update-test-cycle.js +5 -1
  70. package/dist/zephyr/tool/test-execution/create-issue-link.js +4 -2
  71. package/dist/zephyr/tool/test-execution/get-test-steps.js +4 -2
  72. package/dist/zephyr/tool/test-execution/update-test-execution.js +4 -2
  73. package/dist/zephyr/tool/test-execution/update-test-steps.js +4 -2
  74. package/package.json +7 -2
@@ -1,5 +1,5 @@
1
1
  import { QMetryToolsHandlers } from "../../config/constants.js";
2
- import { CreateIssueArgsSchema, UpdateIssueArgsSchema, IssuesListArgsSchema, LinkedIssuesByTestCaseRunArgsSchema, LinkIssuesToTestcaseRunArgsSchema, IssueExecutionsArgsSchema, IssuesLinkedToTestCaseArgsSchema } from "../../types/common.js";
2
+ import { CreateIssueArgsSchema, UpdateIssueArgsSchema, IssuesListArgsSchema, LinkedIssuesByTestCaseRunArgsSchema, LinkIssuesToTestcaseRunArgsSchema, IssueExecutionsArgsSchema, IssuesLinkedToTestCaseArgsSchema, FetchIssueDetailsArgsSchema } from "../../types/common.js";
3
3
  const ISSUE_TOOLS = [
4
4
  {
5
5
  title: "Create Defect or Issue",
@@ -7,11 +7,11 @@ const ISSUE_TOOLS = [
7
7
  summary: "Create a new defect/issue internally in QMetry.",
8
8
  handler: QMetryToolsHandlers.CREATE_ISSUE,
9
9
  inputSchema: CreateIssueArgsSchema,
10
- purpose: "Allows users to create a new defect/issue in QMetry, including issueType, issuePriority, issueOwner and summary. Supports all major defect/issue fields. For fields like sync_with, issueType, issuePriority, issueOwner, component, affectedRelease etc., fetch their valid values using the project info tool. If tcRunID is not provided, it will be auto-resolved to the fetch test case run id but it's optional field.",
10
+ purpose: "REQUIRED WORKFLOW: Before calling this tool, ALWAYS call 'Fetch UDF Layout' (entityType='IS', pageName='ADD') first. That call reveals mandatory UDF fields, system field requirements, and default values to auto-apply. Skipping it causes CO.MANDATORY_FIELDS_MISSING errors. Allows users to create a new defect/issue in QMetry with full system field and UDF support. SYSTEM FIELDS (resolved from project info): issueType, issuePriority, issueOwner, component (used as labels), affectedRelease, affectedCycles, environment, description, tcRunID. UDF FIELDS: pass via udfFields param — LOOKUPLIST (single ID), MULTILOOKUPLIST (array of IDs), CASCADINGLIST ({ parent, child }), STRING, NUMBER, DATETIMEPICKER. Always fetch project info first to resolve valid IDs for system fields. Fetch UDF Layout (entityType=IS, pageName=ADD) before setting UDF values.",
11
11
  useCases: [
12
12
  "Create a basic defect/issue with just a summary",
13
- "Set issueType, issueOwner, component, and affectedRelease using valid IDs from project info",
14
- "Create defects/issues for automation or manual testing types",
13
+ "Set issueType, issueOwner, component (labels), environment, and affectedRelease using valid IDs from project info",
14
+ "Create defects/issues with UDF values (hobby, destination, custom fields)",
15
15
  "Link defects/issues to specific test case runs using tcRunID"
16
16
  ],
17
17
  examples: [
@@ -91,29 +91,141 @@ const ISSUE_TOOLS = [
91
91
  }
92
92
  ],
93
93
  hints: [
94
- "CRITICAL: name (summary), issueType, issuePriority are REQUIRED fields to create an issue",
95
- "OPTIONAL: issueOwner, component, affectedRelease, description, tcRunID can also be provided",
96
- "To get valid values for sync_with (igConfigurationID or internalTrackerId), issueType, issuePriority, issueOwner, component, affectedRelease, and tcRunID, call the 'project get info tools' use the following mappings:",
97
- "- sync_with: customListObjs.component[<index>].igConfigurationID or internalTrackerId",
94
+ "╔══════════════════════════════════════════════════════════════════╗",
95
+ "║ STEP 0 — NON-NEGOTIABLE: Call 'Fetch UDF Layout' BEFORE create ║",
96
+ "╚══════════════════════════════════════════════════════════════════╝",
97
+ "NEVER call 'Create Defect or Issue' without first calling 'Fetch UDF Layout' with entityType='IS', pageName='ADD'.",
98
+ "Skipping this step WILL cause 400 errors (CO.MANDATORY_FIELDS_MISSING) because mandatory fields and defaults are unknown.",
99
+ "This rule has NO exceptions — not even when the user only provided a name and nothing else.",
100
+ "",
101
+ "=== MANDATORY PRE-CREATE CHECK (ALWAYS DO THIS FIRST) ===",
102
+ "Before creating any issue, call 'Fetch UDF Layout' with entityType='IS', pageName='ADD'.",
103
+ "Response keys use 'IS' — same structure as TC but scoped to issue module.",
104
+ "",
105
+ "SYSTEM FIELDS mandatory check — use 'systemFields' array (from qmSDF.IS in newlayout):",
106
+ " Each entry: { name, label, fieldTypeName, isMandatory }",
107
+ " isMandatory=true (allowBlank=false) means field MUST have a value before creating.",
108
+ "",
109
+ "UDF FIELDS mandatory check — use 'fields' array (from qmUDF.IS in newlayout):",
110
+ " Each entry: { name, label, fieldTypeName, isMandatory, listName? }",
111
+ " isMandatory=true means field MUST have a value.",
112
+ "",
113
+ "DEFAULT VALUES — use 'defaultValues' object (from qmDefaultValue.IS in newlayout):",
114
+ " Shape: { fieldName: defaultValueId } e.g. { 'str1': 'Tony Stark', 'lookup19': 5232630, 'component': 5232632 }",
115
+ " IMPORTANT: defaultValues can contain BOTH system field defaults AND UDF field defaults — handle each differently:",
116
+ " → SYSTEM field defaults (fields in qmSDF.IS, e.g. component/Labels, issueType, issuePriority): route to TOP-LEVEL params, NOT to udfFields.",
117
+ " - MULTILOOKUPLIST system fields (e.g. component): default is a single ID — wrap in array: component: [5232632].",
118
+ " - LOOKUPLIST system fields (e.g. issueType, issuePriority): default is a single ID — use directly: issueType: 5232517.",
119
+ " → UDF field defaults (fields in qmUDF.IS, e.g. str1, lookup19, age19): route to udfFields param.",
120
+ " IMPORTANT: QMetry's API sometimes returns 'defaultValues: {}' (empty) even when defaults exist in QMetry settings.",
121
+ " If 'defaultValues' is empty, you cannot auto-apply — ask user for mandatory fields without defaults.",
122
+ " RULE: isMandatory=true AND defaultValues[field.name] exists → auto-use default, do NOT ask user.",
123
+ " RULE: isMandatory=true AND no defaultValues entry → MUST ask user before creating.",
124
+ " RULE: isMandatory=false AND defaultValues entry exists → auto-apply if user didn't specify.",
125
+ "",
126
+ "SYSTEM FIELDS mandatory check — additional caveat:",
127
+ " IMPORTANT: QMetry's API sometimes returns 'systemFields: []' (empty) even when system fields ARE mandatory.",
128
+ " If 'systemFields' is empty, treat the following as always mandatory: summary, issueType, issuePriority.",
129
+ " For issueType/issuePriority defaults: check 'customListObjs.issueType' / 'customListObjs.issuePriority' from Fetch Project Info — use first non-archived entry as fallback.",
130
+ "",
131
+ "╔══════════════════════════════════════════════════════════════════════════╗",
132
+ "║ PRE-FLIGHT DEFAULT SWEEP — MANDATORY STEP BEFORE EVERY CREATE CALL ║",
133
+ "╚══════════════════════════════════════════════════════════════════════════╝",
134
+ "After resolving mandatory fields, sweep ALL defaultValues entries:",
135
+ " For EACH key in defaultValues:",
136
+ " IF the user did not explicitly provide that field → add it to the payload using the default value.",
137
+ " This applies regardless of isMandatory — non-mandatory defaults MUST also be auto-applied.",
138
+ " Route correctly: system fields → top-level params, UDF fields → udfFields.",
139
+ " MULTILOOKUPLIST system fields (e.g. component): wrap single default ID in array → component: [id].",
140
+ " Example: defaultValues = { str1: 'Tony Stark', lookup19: 5232630, component: 5232632 }",
141
+ " → user only said 'create an issue named X'",
142
+ " → payload MUST include: udfFields.str1='Tony Stark', udfFields.lookup19=5232630, component=[5232632]",
143
+ " → WRONG to put component in udfFields — it is a system field and must be a top-level array param.",
144
+ " → WRONG to omit component just because it is not mandatory — it has a default.",
145
+ " Skipping this sweep = missing fields in the created record = user-visible data loss.",
146
+ "╚══════════════════════════════════════════════════════════════════════════╝",
147
+ "",
148
+ "DECISION MATRIX:",
149
+ " | isMandatory | Has default | Action |",
150
+ " |-------------|-------------|-------------------------------------|",
151
+ " | true | YES | Auto-fill with default, no ask |",
152
+ " | true | NO | Ask user before creating |",
153
+ " | false | YES | Auto-fill with default — REQUIRED |",
154
+ " | false | NO | Skip if user didn't provide |",
155
+ "Only after ALL mandatory fields resolved AND default sweep complete → proceed with create.",
156
+ "=== END MANDATORY PRE-CREATE CHECK ===",
157
+ "",
158
+ "=== ERROR RECOVERY: CO.MANDATORY_FIELDS_MISSING ===",
159
+ "If create fails with error code 'CO.MANDATORY_FIELDS_MISSING', DO NOT give up. Auto-recover:",
160
+ " 1. Parse the 'MISSING_FIELDS' list from the error response (comma-separated field labels).",
161
+ " 2. Match each label against 'fields[].label' and 'systemFields[].label' from the Fetch UDF Layout response.",
162
+ " 3. For matched UDF fields: check 'listOptions[field.listName]' for valid option IDs.",
163
+ " 4. For matched system fields (e.g. 'Priority'): check 'customListObjs.issuePriority' from project info.",
164
+ " 5. If the field has a 'defaultValues' entry: auto-fill it silently.",
165
+ " 6. If no default exists: ask the user ONLY for the missing fields by label.",
166
+ " 7. Retry create with the resolved values added to the payload.",
167
+ " NEVER ask user to 'try again' manually — resolve and retry automatically.",
168
+ "=== END ERROR RECOVERY ===",
169
+ "",
170
+ "=== DATE FORMAT CHECK (MANDATORY — EVERY CREATE REQUEST) ===",
171
+ "ALWAYS call 'Fetch QMetry Project Info' before every create request — not only when the user explicitly mentions a date.",
172
+ "Any UDF field could be a DATETIMEPICKER. Wrong format causes QMetry to silently discard the field value (API returns success but value is NOT stored — no error).",
173
+ "STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
174
+ "STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
175
+ "STEP 3: unique_value pattern: yyyy=4-digit year, MM=2-digit month (01-12), dd=2-digit day, MMM=3-letter month (Jan/Feb/...).",
176
+ " Example: id=1 → MM-dd-yyyy → '10-25-2000' | id=2 → dd-MM-yyyy → '25-10-2000' | id=3 → yyyy-MM-dd → '2000-10-25' | id=4 → dd-MMM-yyyy → '25-Oct-2000'",
177
+ "STEP 4: For EVERY DATETIMEPICKER field in the payload: parse any user-provided date and re-format it using the active unique_value pattern before sending.",
178
+ "NEVER assume a date format — always derive it from dateTimeFormatID. Wrong format = silent data loss.",
179
+ "=== END DATE FORMAT CHECK ===",
180
+ "",
181
+ "CRITICAL: summary, issueType, issuePriority are REQUIRED fields to create an issue",
182
+ "OPTIONAL SYSTEM FIELDS: issueOwner, component, affectedRelease, affectedCycles, description, environment, tcRunID",
183
+ "SYSTEM FIELD ID RESOLUTION — fetch project info, then use these mappings:",
98
184
  "- issueType: customListObjs.issueType[<index>].id",
99
185
  "- issuePriority: customListObjs.issuePriority[<index>].id",
100
- "- issueOwner: customListObjs.users[<index>].id",
101
- "- affectedRelease: data[<index>].releaseID",
186
+ "- issueOwner / owner: customListObjs.users[<index>].id (match by name)",
187
+ "- component / labels: customListObjs.component[<index>].id (component acts as labels — pass array of IDs)",
188
+ "- environment: free-text string (e.g. 'Chrome', 'Firefox', 'Production') — pass directly as top-level field, no ID lookup needed",
189
+ "- sync_with: customListObjs.component[<index>].igConfigurationID or internalTrackerId",
102
190
  "- tcRunID: data[<index>].tcRunID (from 'Execution/Fetch Testcase Run ID')",
103
191
  "If the user provides a issuePriority name (e.g. 'Blocker'), fetch project info, find the matching priority in customListObjs.issuePriority[index].name, and use its ID in the payload. If the name is not found, skip the issuePriority field and show a user-friendly message: 'Defect/issue created without issuePriority, as given issuePriority is not available in the current project.'",
104
192
  "If the user provides an issueOwner name, fetch project info, find the matching issueOwner in customListObjs.users[index].name, and use its ID in the payload as issueOwner. If the name is not found, skip the issueOwner field and show a user-friendly message: 'Defect/issue created without issueOwner, as given issueOwner is not available in the current project.'",
105
193
  "If the user provides an issue type name, fetch project info, find the matching type in customListObjs.issueType[index].name, and use its ID in the payload as issueType. If the name is not found, skip the issueType field and show a user-friendly message: 'Defect/issue created without issue type, as given type is not available in the current project.'",
106
- "Release/cycle mapping is optional but useful for planning.",
107
- "If the user wants to link or associate a release and cycle to the issue, follow these rules:",
108
- "If the user provides a release ID, map it from projects.releases[index].releaseID in the project info response, and use that ID in affectedRelease as an array of numeric IDs.",
109
- "If the user provides both release and cycle IDs, validate both against the current project's releases and cycles; if valid, use them in affectedCycles and affectedRelease as arrays of numeric IDs respectively.",
110
- "If the user provides a release name, map it to its ID from project info; if a cycle name is provided, map it to its ID and use it in payload as value of field affectedRelease and affectedCycles.",
111
- "LLM should ensure that provided release/cycle names or IDs exist in the current project before using them in the payload. If not found, skip and show a user-friendly message: 'Issue created without release/cycle association, as given release/cycle is not available in the current project.'",
194
+ "",
195
+ "=== RELEASE/CYCLE ID RESOLUTION (MANDATORY WHEN USER PROVIDES RELEASE OR CYCLE) ===",
196
+ "ALWAYS call 'Fetch Releases and Cycles' tool (FETCH_RELEASES_AND_CYCLES) to resolve release and cycle IDs — do NOT guess IDs from project info.",
197
+ "Fetch Releases and Cycles response structure:",
198
+ " releases[<index>].releaseID → use as affectedRelease value (wrap in array: [releaseID])",
199
+ " releases[<index>].name → release display name to match against user input",
200
+ " releases[<index>].builds[<index>].buildID → use as affectedCycles value (wrap in array: [buildID])",
201
+ " releases[<index>].builds[<index>].name → cycle display name to match against user input",
202
+ "PAYLOAD FORMAT: both affectedRelease and affectedCycles MUST be arrays of numeric IDs:",
203
+ " affectedRelease: [releaseID] e.g. affectedRelease: [92112]",
204
+ " affectedCycles: [buildID] e.g. affectedCycles: [130831]",
205
+ " affectedCycles: [buildID1, buildID2] multiple cycles allowed",
206
+ "WORKFLOW when user provides release/cycle name or ID:",
207
+ " 1. Call FETCH_RELEASES_AND_CYCLES to get all releases and their nested cycles (builds).",
208
+ " 2. Match user's release name/ID → extract releases[<index>].releaseID.",
209
+ " 3. Match user's cycle name/ID within that release → extract releases[<index>].builds[<index>].buildID.",
210
+ " 4. Set affectedRelease: [releaseID] and affectedCycles: [buildID] in payload.",
211
+ "VALIDATION: If the release or cycle name/ID is not found in FETCH_RELEASES_AND_CYCLES response, skip both fields and show: 'Issue created without release/cycle association, as given release/cycle is not available in the current project.'",
212
+ "NEVER pass a single number for affectedRelease or affectedCycles — always wrap in array even for one ID.",
213
+ "=== END RELEASE/CYCLE ID RESOLUTION ===",
214
+ "",
112
215
  "Ensure all IDs used are valid for the current QMetry project context",
113
216
  "This tool is essential for defect management and test execution linkage",
114
217
  "Helps maintain traceability between test executions and reported issues",
115
218
  "Critical for quality assurance and defect lifecycle management",
116
- "Use for creating issues directly from test execution contexts"
219
+ "Use for creating issues directly from test execution contexts",
220
+ "",
221
+ "UDF (User Defined Fields) WORKFLOW FOR CREATE:",
222
+ "1. Call 'Fetch UDF Layout' with entityType='IS', pageName='ADD' to discover field names, types, and list option IDs.",
223
+ " 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.",
224
+ "2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
225
+ "3. For MULTILOOKUPLIST fields: pick an array of IDs.",
226
+ "4. For CASCADINGLIST fields: pick parent ID, then call 'Fetch Cascade Child Values' for child ID. Pass { parent: parentId, child: childId }.",
227
+ "5. Pass all UDF values via 'udfFields' param: { fieldName: value }.",
228
+ "6. Mandatory UDF fields (isMandatory=true) MUST be included or create will fail."
117
229
  ],
118
230
  outputDescription: "JSON object containing the new create issue with id, dfid(defectID).",
119
231
  readOnly: false,
@@ -125,7 +237,7 @@ const ISSUE_TOOLS = [
125
237
  summary: "Update an existing QMetry issue by DefectId and/or entityKey.",
126
238
  handler: QMetryToolsHandlers.UPDATE_ISSUE,
127
239
  inputSchema: UpdateIssueArgsSchema,
128
- purpose: "Update an existing QMetry issue by DefectId and/or entityKey. Only fields provided will be updated. Refer to the Create Issue tool for field mapping and valid values.",
240
+ purpose: "REQUIRED WORKFLOW: Before calling this tool, call 'Fetch UDF Layout' (entityType='IS', pageName='DETAIL') to discover mandatory fields, default values, and valid list option IDs. Skipping this causes missing or incorrect UDF values in updated records. Update an existing QMetry issue by DefectId and/or entityKey. Only fields provided will be updated. Refer to the Create Issue tool for field mapping and valid values.",
129
241
  useCases: [
130
242
  "Update issue summary (title)",
131
243
  "Change issue priority, type, or owner",
@@ -159,12 +271,49 @@ const ISSUE_TOOLS = [
159
271
  }
160
272
  ],
161
273
  hints: [
274
+ "=== DEFAULT VALUES — APPLY FOR ANY UNSET FIELD ===",
275
+ "ALWAYS call 'Fetch UDF Layout' with entityType='IS', pageName='DETAIL' before updating.",
276
+ "defaultValues (from Fetch UDF Layout, i.e. qmDefaultValue.IS): { fieldName: defaultValueId } — sweep ALL entries.",
277
+ " defaultValues can contain BOTH system field defaults AND UDF field defaults — handle each differently:",
278
+ " → SYSTEM field defaults (fields in qmSDF.IS, e.g. component/Labels, issueType, issuePriority): route to TOP-LEVEL params, NOT to udfFields.",
279
+ " - MULTILOOKUPLIST system fields (e.g. component): default is a single ID — wrap in array: component: [5232632].",
280
+ " - LOOKUPLIST system fields (e.g. issueType, issuePriority): default is a single ID — use directly.",
281
+ " → UDF field defaults (fields in qmUDF.IS, e.g. str1, lookup19, age19): route to udfFields param.",
282
+ " For EACH key in defaultValues: if user did not explicitly provide that field → include it in payload using default, routed correctly.",
283
+ " This applies to non-mandatory fields too (e.g. component/Labels). Omitting them = data loss.",
284
+ " IMPORTANT: QMetry's API sometimes returns 'defaultValues: {}' (empty) — if so, skip auto-apply and ask user for mandatory fields without defaults.",
285
+ "systemFields (from qmSDF.IS): isMandatory=true fields must retain a valid value after update.",
286
+ " IMPORTANT: QMetry's API sometimes returns 'systemFields: []' (empty). If so, treat summary, issueType, issuePriority as always mandatory.",
287
+ "fields/UDF (from qmUDF.IS): isMandatory=true UDF fields must be included if being changed.",
288
+ "=== END DEFAULT VALUES ===",
289
+ "",
290
+ "=== DATE FORMAT CHECK (MANDATORY — EVERY UPDATE REQUEST) ===",
291
+ "ALWAYS call 'Fetch QMetry Project Info' before every update request — not only when the user explicitly mentions a date.",
292
+ "Any UDF field could be a DATETIMEPICKER. Wrong format causes QMetry to silently discard the field value (API returns success but value is NOT stored — no error).",
293
+ "STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
294
+ "STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
295
+ "STEP 3: unique_value pattern: yyyy=4-digit year, MM=2-digit month (01-12), dd=2-digit day, MMM=3-letter month (Jan/Feb/...).",
296
+ " Example: id=1 → MM-dd-yyyy → '10-25-2000' | id=2 → dd-MM-yyyy → '25-10-2000' | id=3 → yyyy-MM-dd → '2000-10-25' | id=4 → dd-MMM-yyyy → '25-Oct-2000'",
297
+ "STEP 4: For EVERY DATETIMEPICKER field in the payload: parse any user-provided date and re-format it using the active unique_value pattern before sending.",
298
+ "NEVER assume a date format — always derive it from dateTimeFormatID. Wrong format = silent data loss.",
299
+ "=== END DATE FORMAT CHECK ===",
300
+ "",
162
301
  "To get the DefectId, call the Issue/Fetch issue tool and use data[<index>].id from the response.",
163
302
  "if you have pass issue key (VT-IS-5, MAC-IS-10 etc.) then first fetch issue by issue key to get issue id.",
164
303
  "Along with DefectId, pass only those fields which are to be updated.",
165
304
  "Refer to the Create Issue tool for valid field mappings and values.",
166
305
  "You can update summary, priority, type, affectedRelease, affectedCycles, description, sync_with, issueOwner, component, environment, tcRunID, etc.",
167
- "If you provide entityKey, it will be used for additional validation but DefectId is required."
306
+ "If you provide entityKey, it will be used for additional validation but DefectId is required.",
307
+ "",
308
+ "UDF (User Defined Fields) WORKFLOW FOR UPDATE:",
309
+ "1. Call 'Fetch UDF Layout' with entityType='IS', pageName='DETAIL' to get field names, fieldIDs (projectUserFieldID), and list option IDs.",
310
+ " 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.",
311
+ "2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
312
+ "3. For MULTILOOKUPLIST fields: pick array of IDs; also pass alias flat key (e.g., fieldNameAlias: 'Option Label').",
313
+ "4. For CASCADINGLIST fields: pick parent ID + fetch child with 'Fetch Cascade Child Values'. Pass { parent: parentId, child: childId }.",
314
+ "5. Pass BOTH 'udfFields' (flat root values) AND 'UDF' wrapper (with fieldID) — both required for update.",
315
+ " Example: udfFields: { is_field: 'value' }, UDF: { is_field: { fieldID: 3001, value: 'value' } }",
316
+ "6. Mandatory UDF fields (isMandatory=true) MUST be included."
168
317
  ],
169
318
  outputDescription: "JSON object with update status and details.",
170
319
  readOnly: false,
@@ -270,7 +419,7 @@ const ISSUE_TOOLS = [
270
419
  "Use for compliance reporting and issue traceability",
271
420
  "Helps maintain visibility into project defects and issues"
272
421
  ],
273
- outputDescription: "JSON object with 'data' array containing issues and pagination info",
422
+ outputDescription: "JSON object with 'data' array containing issues. Each issue has 'id' (numeric defect ID — use this as defectId for Fetch Issue Details), 'entityKey', 'name'/'summary', and other fields. There is no 'DefectId' field in this response — 'id' is the defect identifier.",
274
423
  readOnly: true,
275
424
  idempotent: true,
276
425
  openWorld: false
@@ -578,11 +727,12 @@ const ISSUE_TOOLS = [
578
727
  `AUTO-RESOLVE FILTER EXAMPLE: to resolve VKT-IS-5 → use filter '[{"type":"string","value":"VKT-IS-5","field":"entityKeyId"}]' in Fetch Defects or Issues tool`,
579
728
  "This tool supports QMetry-native issues only — do NOT use for Jira-integrated projects",
580
729
  "API SOURCE: Execution rows and saved UDF values come from /rest/execution/getExecutionsForIssue. The udfjson field contains saved Test Run UDF values, e.g. Tested_By, execution_type, Country_mcp_udf, environments_udf.",
581
- "METADATA SOURCE: This tool also calls Test Run UDF metadata once to get all available labels, fieldIDs, field types, and empty fields. Merge metadata fields with udfjson values by UDF name.",
730
+ "METADATA SOURCE: This tool also calls Test Run UDF metadata once to get all available labels, fieldIDs, field types, list options (qmUDFList), and empty fields. Merge metadata fields with udfjson values by UDF name.",
582
731
  "RESPONSE FIELDS: hasTcRunUdf=true means executions have UDF data; each execution includes a 'testRunUdfs' array with ALL project-defined UDF fields",
583
732
  "ALL UDF FIELDS: ALL project-defined Test Run UDF fields are returned for every execution — including fields not yet set (value: null)",
584
733
  "Each element in testRunUdfs: { name, label, fieldID, fieldType, value } — use fieldID when calling 'Bulk Update Test Run UDFs'",
585
- 'EXAMPLE testRunUdfs: [{ "name": "TRString", "label": "TR String", "fieldID": 229241, "fieldType": "STRING", "value": "test" }, { "name": "dateField", "label": "Date", "fieldID": 229255, "fieldType": "DATETIMEPICKER", "value": null }]',
734
+ "VALUE RESOLUTION: For LOOKUPLIST and MULTILOOKUPLIST fields, values are resolved from their internal uniqueLabel key to the human-readable display name using qmUDFList lookup options. Always display the resolved name, not the raw uniqueLabel.",
735
+ 'EXAMPLE testRunUdfs: [{ "name": "TRString", "label": "TR String", "fieldID": 229241, "fieldType": "STRING", "value": "test" }, { "name": "lookup_browser", "label": "Lookup Browser MCP", "fieldID": 229433, "fieldType": "LOOKUPLIST", "value": "Chrome" }, { "name": "dateField", "label": "Date", "fieldID": 229255, "fieldType": "DATETIMEPICKER", "value": null }]',
586
736
  "FILTER FIELDS:",
587
737
  " - tcName (string): filter by test case name substring",
588
738
  " - linkageLevel (string): 'Test Case' or 'Test Step'",
@@ -598,7 +748,7 @@ const ISSUE_TOOLS = [
598
748
  "Execution status names are case-sensitive — use lowercase: 'failed', 'passed', 'in progress', 'blocked', 'not run'",
599
749
  "hasTcRunUdf: false → No Test Run UDFs configured; testRunUdfs will not appear; a 'testRunUdfNote' field explains this."
600
750
  ],
601
- outputDescription: "JSON object with 'data' array of execution records, 'hasTcRunUdf' boolean flag, and 'total' count. Each execution record ALWAYS contains these mandatory identification fields: 'tsEntityKey' (Test Suite Key, e.g. 'MAC-TS-42'), 'tsName' (Test Suite Name), 'releaseName' (Release), 'cycleName' (Cycle), 'platformName' (Platform/environment), 'executedVersion' (Executed Version of the test case), 'runStatusName' (Execution Status label), 'tcRunID' (numeric Test Run ID), 'tcName' (Test Case Name), 'tcEntityKey' (Test Case Key), and 'testRunUdfs' (array of objects each with name, label, fieldID, fieldType, value — use 'label' for display headers, null if not set). ALL project-defined UDF fields are always included, even those with no value. When hasTcRunUdf is false, a 'testRunUdfNote' field provides a professional explanation instead.",
751
+ outputDescription: "JSON object with 'data' array of execution records, 'hasTcRunUdf' boolean flag, and 'total' count. Each execution record ALWAYS contains these mandatory identification fields: 'tsEntityKey' (Test Suite Key, e.g. 'MAC-TS-42'), 'tsName' (Test Suite Name), 'releaseName' (Release), 'cycleName' (Cycle), 'platformName' (Platform/environment), 'executedVersion' (Executed Version of the test case), 'runStatusName' (Execution Status label), 'tcRunID' (numeric Test Run ID), 'tcName' (Test Case Name), 'tcEntityKey' (Test Case Key), and 'testRunUdfs' (array of objects each with name, label, fieldID, fieldType, value — use 'label' for display headers, null if not set). For LOOKUPLIST and MULTILOOKUPLIST fields, 'value' contains the resolved human-readable display name (from qmUDFList), not the raw internal uniqueLabel key. ALL project-defined UDF fields are always included, even those with no value. When hasTcRunUdf is false, a 'testRunUdfNote' field provides a professional explanation instead.",
602
752
  readOnly: true,
603
753
  idempotent: true,
604
754
  openWorld: false
@@ -697,6 +847,35 @@ const ISSUE_TOOLS = [
697
847
  outputDescription: "JSON object with issues array containing issue details, priorities, status, and linkage information",
698
848
  readOnly: true,
699
849
  idempotent: true
850
+ },
851
+ {
852
+ title: "Fetch Issue Details",
853
+ toolset: "Issues",
854
+ summary: "Fetch full detail data for a QMetry issue including UDF field values",
855
+ handler: QMetryToolsHandlers.FETCH_ISSUE_DETAILS,
856
+ inputSchema: FetchIssueDetailsArgsSchema,
857
+ purpose: "Get complete issue details including UDF values. Use this when you need UDF field data for a specific issue — the list API (Fetch Issues) omits UDF values.",
858
+ useCases: [
859
+ "Get UDF field values for a specific issue",
860
+ "Retrieve full issue metadata including custom fields",
861
+ "Inspect issue details before updating UDF values"
862
+ ],
863
+ examples: [
864
+ {
865
+ description: "Fetch details for issue with DefectId 1430676",
866
+ parameters: { defectId: 1430676 },
867
+ expectedOutput: "Full issue detail object with UDFTypeData map and all UDF field values including MUL1, TCR_STR, etc."
868
+ }
869
+ ],
870
+ hints: [
871
+ "CRITICAL: Use 'data[<index>].id' from Fetch Issues/Defects response as 'defectId'. The list API response field is named 'id' — there is no 'DefectId' field in the list response. Do NOT guess or derive defectId from the entity key suffix.",
872
+ `AUTO-RESOLVE: If user provides an issue entity key (e.g. VKMCP2-IS-1, MAC-IS-10), first call Fetch Defects or Issues with filter '[{"type":"string","value":"VKMCP2-IS-1","field":"entityKeyId"}]', then use 'data[<index>].id' as defectId.`,
873
+ "UDF VALUES: Response includes a 'UDFTypeData' map with all UDF field values for the issue.",
874
+ "WORKFLOW: To fetch issue UDF values — (1) Fetch Issues with entityKey filter → get data[0].id, (2) in parallel Fetch UDF Layout entityType='IS' pageName='DETAIL' → get field labels/types, (3) call this tool with defectId=data[0].id → read UDFTypeData."
875
+ ],
876
+ outputDescription: "JSON object with data property containing full issue details including UDFTypeData map and all UDF field values",
877
+ readOnly: true,
878
+ idempotent: true
700
879
  }
701
880
  ];
702
881
  export {
@@ -141,9 +141,21 @@ const PROJECT_TOOLS = [
141
141
  "Always call this first when user doesn't provide viewId or folderPath",
142
142
  "Use 'default' project key when user doesn't specify one",
143
143
  "Extract viewId from latestViews.TC.viewId for test case operations",
144
- "Use empty string '' as folderPath for root directory"
144
+ "Use empty string '' as folderPath for root directory",
145
+ "DATE FORMAT — IMPORTANT: response contains 'dateTimeFormatID' (number) and 'dateTimeFormatNew' (array).",
146
+ " dateTimeFormatID = active format ID for this project.",
147
+ " dateTimeFormatNew = [{ id, name, unique_value }] — find entry where id === dateTimeFormatID.",
148
+ " unique_value is the authoritative date format pattern using Java/QMetry conventions:",
149
+ " yyyy = 4-digit year | MM = 2-digit month (01-12) | dd = 2-digit day | MMM = 3-letter month (Jan/Feb/...)",
150
+ " Example mappings:",
151
+ " unique_value 'MM-dd-yyyy' → format: 12-25-2024",
152
+ " unique_value 'dd-MM-yyyy' → format: 25-12-2024",
153
+ " unique_value 'yyyy-MM-dd' → format: 2024-12-25",
154
+ " unique_value 'dd-MMM-yyyy' → format: 25-Dec-2024",
155
+ " Always use this format when sending date values in any create/update payload.",
156
+ " Always parse user-provided dates and reformat them to this pattern before sending to API."
145
157
  ],
146
- outputDescription: "JSON object containing project details, viewIds, folderPaths, and project configuration",
158
+ outputDescription: "JSON object containing project details, viewIds, folderPaths, project configuration, 'dateTimeFormatID' (active date format ID), and 'dateTimeFormatNew' array (each entry: { id, name, unique_value } — use unique_value of the matching entry as the date format pattern for all API date fields).",
147
159
  readOnly: true,
148
160
  idempotent: true
149
161
  },