@smartbear/mcp 0.36.0 → 0.38.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.
- package/dist/bugsnag/client.js +101 -22
- package/dist/common/initialize.js +0 -3
- package/dist/common/pollyfills.js +1 -43
- package/dist/common/server.js +0 -7
- package/dist/package.json.js +1 -1
- package/dist/pactflow/client/ai.js +0 -2
- package/dist/pactflow/client/prompt-utils.js +7 -86
- package/dist/pactflow/client/prompts.js +11 -31
- package/dist/pactflow/client/tools.js +0 -2
- package/dist/pactflow/client.js +7 -38
- package/dist/qmetry/client/auto-resolve.js +5 -0
- package/dist/qmetry/client/date-utils.js +104 -0
- package/dist/qmetry/client/handlers.js +9 -5
- package/dist/qmetry/client/issues.js +124 -7
- package/dist/qmetry/client/testcase.js +36 -2
- package/dist/qmetry/client/testsuite.js +27 -2
- package/dist/qmetry/client/tools/issue-tools.js +202 -23
- package/dist/qmetry/client/tools/project-tools.js +14 -2
- package/dist/qmetry/client/tools/testcase-tools.js +275 -14
- package/dist/qmetry/client/tools/testsuite-tools.js +152 -5
- package/dist/qmetry/client/tools/udf-tools.js +83 -5
- package/dist/qmetry/client/udf.js +159 -4
- package/dist/qmetry/client.js +236 -1
- package/dist/qmetry/config/constants.js +5 -1
- package/dist/qmetry/config/rest-endpoints.js +7 -3
- package/dist/qmetry/types/common.js +113 -12
- package/dist/qmetry/types/testcase.js +1 -2
- package/dist/qmetry/types/udf.js +12 -1
- package/dist/swagger/client/api.js +120 -15
- package/dist/swagger/client/functional-testing-api.js +7 -1
- package/dist/swagger/client/functional-testing-tools.js +20 -17
- package/dist/swagger/client/functional-testing-types.js +184 -1
- package/dist/swagger/client/patch-spec-utils.js +31 -0
- package/dist/swagger/client/portal-types.js +2 -1
- package/dist/swagger/client/registry-types.js +44 -0
- package/dist/swagger/client/tools.js +11 -2
- package/dist/swagger/client/utils.js +8 -0
- package/dist/swagger/client.js +5 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QMetryToolsHandlers } from "../../config/constants.js";
|
|
2
|
-
import { CreateTestCaseArgsSchema, UpdateTestCaseArgsSchema, TestCaseListArgsSchema, TestCaseDetailsArgsSchema, TestCaseVersionDetailsArgsSchema, TestCaseStepsArgsSchema, TestCaseExecutionsArgsSchema } from "../../types/common.js";
|
|
2
|
+
import { CreateTestCaseArgsSchema, UpdateTestCaseArgsSchema, TestCaseListArgsSchema, TestCaseDetailsArgsSchema, TestCaseVersionDetailsArgsSchema, TestCaseStepsArgsSchema, TestCaseExecutionsArgsSchema, TestCaseStepsWithUdfArgsSchema } from "../../types/common.js";
|
|
3
3
|
const TESTCASE_TOOLS = [
|
|
4
4
|
{
|
|
5
5
|
title: "Create Test Case",
|
|
@@ -7,7 +7,7 @@ const TESTCASE_TOOLS = [
|
|
|
7
7
|
summary: "Create a new test case in QMetry with steps, metadata, and release/cycle mapping.",
|
|
8
8
|
handler: QMetryToolsHandlers.CREATE_TEST_CASE,
|
|
9
9
|
inputSchema: CreateTestCaseArgsSchema,
|
|
10
|
-
purpose: "Allows users to create a new test case in QMetry,
|
|
10
|
+
purpose: "REQUIRED WORKFLOW: Before calling this tool, ALWAYS call 'Fetch UDF Layout' (entityType='TC', 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 test case in QMetry, optionally with steps, custom fields, and release/cycle mapping. Supports all major test case fields and step-level UDFs. For fields like priority, owner, component, etc., fetch their valid values using the project info tool. If tcFolderID is not provided, it will be auto-resolved to the root test case folder using project info.\n\nSTEPS DECISION RULE (CRITICAL — apply before every create call):\nDEFAULT: Do NOT include 'steps' in the payload. Omit the field entirely.\nA test case without steps is fully valid. Most users only want steps when they say so.\nInclude 'steps' ONLY in these two scenarios:\n 1. User explicitly mentions steps in their prompt (e.g., 'create with steps', 'step 1 - ...', 'add these steps').\n 2. Fetch UDF Layout returns stepSystemFields[] OR stepFields[] with isMandatory=true on any field — backend requires at least 1 step. Fill mandatory step UDF fields in step.UDF.\nIn all other cases: omit 'steps' field. NEVER send steps: [] (empty array).",
|
|
11
11
|
useCases: [
|
|
12
12
|
"Create a basic test case with just a name and folder",
|
|
13
13
|
"Add detailed steps with custom fields (UDFs) to a test case",
|
|
@@ -20,22 +20,44 @@ const TESTCASE_TOOLS = [
|
|
|
20
20
|
],
|
|
21
21
|
examples: [
|
|
22
22
|
{
|
|
23
|
-
description: "Create
|
|
23
|
+
description: "MOST COMMON: Create test case with name only — NO steps (user did not mention steps). Steps field is OMITTED from payload.",
|
|
24
24
|
parameters: {
|
|
25
25
|
name: "Login Test Case"
|
|
26
26
|
},
|
|
27
|
-
expectedOutput: "Test case created
|
|
27
|
+
expectedOutput: "Test case created without steps. Steps field omitted entirely from payload — do NOT add steps: []."
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
description: "Create
|
|
30
|
+
description: "Create test case with metadata only — no steps (user did not mention steps)",
|
|
31
31
|
parameters: {
|
|
32
32
|
tcFolderID: "102653",
|
|
33
|
-
name: "Login Test Case"
|
|
33
|
+
name: "Login Test Case",
|
|
34
|
+
priority: 2025268,
|
|
35
|
+
testCaseState: 2025271,
|
|
36
|
+
estimatedTime: 3600,
|
|
37
|
+
description: "Verifies login flow"
|
|
38
|
+
},
|
|
39
|
+
expectedOutput: "Test case created with metadata, no steps. Steps omitted from payload."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
description: "SCENARIO 1: User explicitly asked for steps — 'create test case with step 1 - Go to login page, step 2 - enter credentials'",
|
|
43
|
+
parameters: {
|
|
44
|
+
tcFolderID: "102653",
|
|
45
|
+
name: "Login Flow Test",
|
|
46
|
+
steps: [
|
|
47
|
+
{
|
|
48
|
+
orderId: 1,
|
|
49
|
+
description: "Go to login page"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
orderId: 2,
|
|
53
|
+
description: "Enter credentials"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
34
56
|
},
|
|
35
|
-
expectedOutput: "Test case created with
|
|
57
|
+
expectedOutput: "Test case created with 2 steps because user explicitly mentioned steps in prompt."
|
|
36
58
|
},
|
|
37
59
|
{
|
|
38
|
-
description: "
|
|
60
|
+
description: "SCENARIO 1: User provided steps with full metadata (steps explicitly mentioned in prompt)",
|
|
39
61
|
parameters: {
|
|
40
62
|
tcFolderID: "102653",
|
|
41
63
|
name: "Test Case 1",
|
|
@@ -68,13 +90,160 @@ const TESTCASE_TOOLS = [
|
|
|
68
90
|
}
|
|
69
91
|
]
|
|
70
92
|
},
|
|
71
|
-
expectedOutput: "Test case created with steps
|
|
93
|
+
expectedOutput: "Test case created with steps because user explicitly requested steps. All metadata populated."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
description: "SCENARIO 2: stepSystemFields has isMandatory=true — backend requires at least 1 step even though user did not ask for steps",
|
|
97
|
+
parameters: {
|
|
98
|
+
name: "Mandatory Step Test Case",
|
|
99
|
+
steps: [
|
|
100
|
+
{
|
|
101
|
+
orderId: 1,
|
|
102
|
+
description: "Step 1"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
expectedOutput: "Test case created with 1 mandatory step because stepSystemFields from Fetch UDF Layout had isMandatory=true. User was not prompted for step details — a minimal step was included to satisfy backend requirement."
|
|
72
107
|
}
|
|
73
108
|
],
|
|
74
109
|
hints: [
|
|
110
|
+
"╔══════════════════════════════════════════════════════════════════════════════╗",
|
|
111
|
+
"║ STEPS DECISION RULE — APPLY BEFORE EVERY CREATE CALL (NO EXCEPTIONS) ║",
|
|
112
|
+
"╚══════════════════════════════════════════════════════════════════════════════╝",
|
|
113
|
+
"",
|
|
114
|
+
"DEFAULT: OMIT 'steps' from payload. Do NOT include steps: [] (empty array).",
|
|
115
|
+
"Test cases without steps are fully valid. The backend does NOT require steps unless noted below.",
|
|
116
|
+
"",
|
|
117
|
+
"INCLUDE 'steps' ONLY in exactly 2 scenarios:",
|
|
118
|
+
"",
|
|
119
|
+
" SCENARIO 1 — User explicitly mentions steps in their prompt.",
|
|
120
|
+
" Trigger phrases: 'with steps', 'step 1 -', 'add steps', 'include steps', 'following steps', 'these steps'.",
|
|
121
|
+
" Action: Parse the user's step text into { orderId, description, inputData?, expectedOutcome? } objects.",
|
|
122
|
+
" Example: 'create test case, step 1 - open browser, step 2 - click login'",
|
|
123
|
+
" → steps: [{ orderId: 1, description: 'open browser' }, { orderId: 2, description: 'click login' }]",
|
|
124
|
+
"",
|
|
125
|
+
" SCENARIO 2 — Fetch UDF Layout returns stepSystemFields[] OR stepFields[] with isMandatory=true on any entry.",
|
|
126
|
+
" Trigger: stepSystemFields (built-in step fields) OR stepFields (step-level UDFs) has at least 1 field where isMandatory=true.",
|
|
127
|
+
" Action: MUST include at least 1 step. If user gave no step text, use description='Step 1' as placeholder.",
|
|
128
|
+
" Also fill mandatory step UDF fields (from stepFields) in step.UDF — use stepDefaultValues if defaults exist, else a placeholder value.",
|
|
129
|
+
" IMPORTANT: Inform the user that a step was required by the backend configuration.",
|
|
130
|
+
"",
|
|
131
|
+
"NEVER include steps in any other case — including when the user only says 'create test case named X'.",
|
|
132
|
+
"NEVER send steps: [] — either omit the key entirely OR send array with at least 1 valid step.",
|
|
133
|
+
"",
|
|
134
|
+
"QUICK DECISION TABLE:",
|
|
135
|
+
" | User mentioned steps? | stepSystemFields OR stepFields mandatory? | Action |",
|
|
136
|
+
" |-----------------------|------------------------------------------|---------------------------------------------------------------|",
|
|
137
|
+
" | NO | NO | OMIT steps entirely (most common case) |",
|
|
138
|
+
" | YES | NO | Include steps from user's prompt |",
|
|
139
|
+
" | NO | YES | Include 1 placeholder step + fill mandatory step UDFs, inform user |",
|
|
140
|
+
" | YES | YES | Include steps from user's prompt + fill mandatory step UDFs |",
|
|
141
|
+
"",
|
|
142
|
+
"╚══════════════════════════════════════════════════════════════════════════════╝",
|
|
143
|
+
"",
|
|
144
|
+
"╔══════════════════════════════════════════════════════════════════╗",
|
|
145
|
+
"║ STEP 0 — NON-NEGOTIABLE: Call 'Fetch UDF Layout' BEFORE create ║",
|
|
146
|
+
"╚══════════════════════════════════════════════════════════════════╝",
|
|
147
|
+
"NEVER call 'Create Test Case' without first calling 'Fetch UDF Layout' with entityType='TC', pageName='ADD'.",
|
|
148
|
+
"Skipping this step WILL cause 400 errors (CO.MANDATORY_FIELDS_MISSING) because mandatory fields and defaults are unknown.",
|
|
149
|
+
"This rule has NO exceptions — not even when the user only provided a name and nothing else.",
|
|
150
|
+
"",
|
|
151
|
+
"=== MANDATORY PRE-CREATE CHECK ===",
|
|
152
|
+
"",
|
|
153
|
+
"SYSTEM FIELDS mandatory check — use 'systemFields' array from Fetch UDF Layout:",
|
|
154
|
+
" Each entry: { name, label, fieldTypeName, isMandatory }",
|
|
155
|
+
" isMandatory=true (allowBlank=false in QMetry) means the field MUST have a value.",
|
|
156
|
+
" IMPORTANT: QMetry's API sometimes returns 'systemFields: []' (empty) even when system fields ARE mandatory.",
|
|
157
|
+
" If 'systemFields' is empty, treat the following as always mandatory: name (Summary), testCaseState (Status).",
|
|
158
|
+
" For testCaseState default: check 'customListObjs.testCaseState' from Fetch Project Info — use first non-archived entry as fallback.",
|
|
159
|
+
"",
|
|
160
|
+
"UDF FIELDS mandatory check — use 'fields' array from Fetch UDF Layout:",
|
|
161
|
+
" Each entry: { name, label, fieldTypeName, isMandatory, listName? }",
|
|
162
|
+
" IMPORTANT: QMetry's API sometimes returns isMandatory=false for fields that ARE enforced as mandatory.",
|
|
163
|
+
" The 'isMandatory' flag is a hint, not a guarantee. Trust the actual API error over this flag.",
|
|
164
|
+
" When isMandatory=true: field MUST have a value.",
|
|
165
|
+
"",
|
|
166
|
+
"DEFAULT VALUES — use 'defaultValues' object from Fetch UDF Layout:",
|
|
167
|
+
" Shape: { fieldName: defaultValueId } e.g. { 'lookup19': 5232630, 'estimatedTime': 18305.0, 'priority': 5232497 }",
|
|
168
|
+
" These are pre-configured QMetry defaults. ALWAYS auto-apply them — even when user did not mention the field.",
|
|
169
|
+
" IMPORTANT: QMetry's API sometimes returns 'defaultValues: {}' (empty) even when defaults exist in QMetry settings.",
|
|
170
|
+
" If 'defaultValues' is empty, you cannot auto-apply — ask user for mandatory fields without defaults.",
|
|
171
|
+
" RULE: if isMandatory=true AND defaultValues[field.name] exists → use default, do NOT ask user.",
|
|
172
|
+
" RULE: if isMandatory=true AND NO defaultValues[field.name] → MUST ask user before creating.",
|
|
173
|
+
" RULE: if isMandatory=false AND defaultValues[field.name] exists → auto-apply default if user didn't specify.",
|
|
174
|
+
" RULE: if isMandatory=false AND no default → skip if user didn't provide.",
|
|
175
|
+
"",
|
|
176
|
+
"╔══════════════════════════════════════════════════════════════════════════╗",
|
|
177
|
+
"║ PRE-FLIGHT DEFAULT SWEEP — MANDATORY STEP BEFORE EVERY CREATE CALL ║",
|
|
178
|
+
"╚══════════════════════════════════════════════════════════════════════════╝",
|
|
179
|
+
"After resolving mandatory fields, do a full sweep of ALL defaultValues entries:",
|
|
180
|
+
" For EACH key in defaultValues:",
|
|
181
|
+
" IF the user did not explicitly provide that field → add it to the payload using the default value.",
|
|
182
|
+
" This applies regardless of isMandatory — non-mandatory defaults MUST also be auto-applied.",
|
|
183
|
+
" Example: defaultValues = { lookup19: 5232630, estimatedTime: 18305, priority: 5232497 }",
|
|
184
|
+
" → user only said 'create a test case named X'",
|
|
185
|
+
" → payload MUST include: lookup19=5232630, estimatedTime=18305, priority=5232497",
|
|
186
|
+
" → WRONG to omit priority/estimatedTime just because they are not mandatory — they have defaults.",
|
|
187
|
+
" Skipping this sweep = missing fields in the created record = user-visible data loss.",
|
|
188
|
+
"╚══════════════════════════════════════════════════════════════════════════╝",
|
|
189
|
+
"",
|
|
190
|
+
"TEST CASE STEPS mandatory check — use BOTH 'stepSystemFields' AND 'stepFields' arrays from Fetch UDF Layout:",
|
|
191
|
+
" stepSystemFields: built-in step fields { name, label, fieldTypeName, isMandatory }",
|
|
192
|
+
" stepFields: step-level UDF fields { name, label, fieldTypeName, isMandatory, listName? }",
|
|
193
|
+
" If ANY field in EITHER array has isMandatory=true → SCENARIO 2 triggered → MUST include at least 1 step.",
|
|
194
|
+
" Mandatory stepFields UDFs must be filled in step.UDF — use stepDefaultValues for defaults, else placeholder.",
|
|
195
|
+
" If NO field in EITHER array has isMandatory=true AND user did not mention steps → OMIT steps from payload.",
|
|
196
|
+
" Step defaults: use 'stepDefaultValues' object — same auto-fill logic as defaultValues.",
|
|
197
|
+
"",
|
|
198
|
+
"DECISION MATRIX:",
|
|
199
|
+
" | isMandatory | Has default | Action |",
|
|
200
|
+
" |-------------|-------------|-------------------------------------|",
|
|
201
|
+
" | true | YES | Auto-fill with default, no ask |",
|
|
202
|
+
" | true | NO | Ask user before creating |",
|
|
203
|
+
" | false | YES | Auto-fill with default — REQUIRED |",
|
|
204
|
+
" | false | NO | Skip if user didn't provide |",
|
|
205
|
+
"",
|
|
206
|
+
"Only after ALL mandatory fields are resolved AND default sweep is complete → proceed with create.",
|
|
207
|
+
"=== END MANDATORY PRE-CREATE CHECK ===",
|
|
208
|
+
"",
|
|
209
|
+
"=== ERROR RECOVERY: CO.MANDATORY_FIELDS_MISSING ===",
|
|
210
|
+
"If create fails with error code 'CO.MANDATORY_FIELDS_MISSING', DO NOT give up. Auto-recover:",
|
|
211
|
+
" 1. Parse the 'MISSING_FIELDS' list from the error response (comma-separated field labels).",
|
|
212
|
+
" 2. Match each label against 'fields[].label' and 'systemFields[].label' from the Fetch UDF Layout response.",
|
|
213
|
+
" 3. For matched UDF fields: check 'listOptions[field.listName]' for valid option IDs.",
|
|
214
|
+
" 4. For matched system fields (e.g. 'Status'): check 'customListObjs.testCaseState' from project info.",
|
|
215
|
+
" 5. If the field has a 'defaultValues' entry: auto-fill it silently.",
|
|
216
|
+
" 6. If no default exists: ask the user ONLY for the missing fields by label.",
|
|
217
|
+
" 7. Retry create with the resolved values added to the payload.",
|
|
218
|
+
" NEVER ask user to 'try again' manually — resolve and retry automatically.",
|
|
219
|
+
"=== END ERROR RECOVERY ===",
|
|
220
|
+
"",
|
|
221
|
+
"=== DATE FORMAT CHECK (MANDATORY — EVERY CREATE REQUEST) ===",
|
|
222
|
+
"ALWAYS call 'Fetch QMetry Project Info' before every create request — not only when the user explicitly mentions a date.",
|
|
223
|
+
"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).",
|
|
224
|
+
"Project info response contains 'dateTimeFormatID' and 'dateTimeFormatNew' array.",
|
|
225
|
+
"STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
|
|
226
|
+
"STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
|
|
227
|
+
"STEP 3: unique_value is the Java/QMetry format pattern. Mapping:",
|
|
228
|
+
" yyyy = 4-digit year | MM = 2-digit month (01-12) | dd = 2-digit day | MMM = 3-letter month (Jan/Feb/...)",
|
|
229
|
+
" 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'",
|
|
230
|
+
"STEP 4: For EVERY DATETIMEPICKER field in the payload (user-provided OR from defaultValues):",
|
|
231
|
+
" - Parse the date regardless of what format the user typed",
|
|
232
|
+
" - Re-format it using the active unique_value pattern",
|
|
233
|
+
" - Send the re-formatted string to the API",
|
|
234
|
+
"Examples with unique_value='yyyy-MM-dd':",
|
|
235
|
+
" User says '25 Dec 2024' → send '2024-12-25'",
|
|
236
|
+
" User says '12/25/2024' → send '2024-12-25'",
|
|
237
|
+
" Default value is a date string '2024-12-25' → already correct, keep it",
|
|
238
|
+
"NEVER send a date in a format different from the project's active dateTimeFormatID format.",
|
|
239
|
+
"Fetch project info ONCE per create/update operation and reuse dateTimeFormatID for all date fields.",
|
|
240
|
+
"=== END DATE FORMAT CHECK ===",
|
|
241
|
+
"",
|
|
75
242
|
"If tcFolderID is not provided, it will be auto-resolved to the root test case folder using project info (rootFolders.TC.id).",
|
|
76
243
|
"To get valid values for priority, owner, component, etc., call the project info tool and use the returned customListObjs IDs.",
|
|
77
|
-
"If the user
|
|
244
|
+
"STALE / NOT-FOUND ID RECOVERY (applies to ALL system fields — priority, component/label, owner, status, testCaseType, testingType, release, cycle): If the user references a value by name and it is NOT found in your current cached project info data, DO NOT give up or skip the field immediately. Instead: call 'Fetch QMetry Project Info' fresh (no arguments needed) to get the latest snapshot, then re-scan the relevant customListObjs list. This is mandatory when: (a) the user just added a new label/priority/status/user in QMetry UI, or (b) the cached info is from an earlier turn. Only skip + show a friendly message if the value is still missing AFTER the fresh fetch.",
|
|
245
|
+
`FOLDER ID RESOLUTION (tcFolderID): Project info only exposes the ROOT folder ID (rootFolders.TC.id). Sub-folder IDs are NOT returned by project info. If the user specifies a sub-folder (e.g. 'Folder 1'), use this resolution order: 1. Check if the user already provided the numeric folder ID — use it directly. 2. Try fetching test cases with folderPath='<folder name>' and scope='folder' — if a TC exists there, its folder context confirms the path, but the ID is still needed from the UI. 3. If still unresolved, ask the user: 'Please provide the numeric folder ID for "<folder name>". You can find it in the QMetry URL when browsing that folder (look for folderId=XXXXX).' NEVER silently fall back to root folder when the user explicitly named a sub-folder — always ask first.`,
|
|
246
|
+
"If the user provides a priority name (e.g. 'Blocker'), fetch project info, find the matching priority in customListObjs.priority[index].name, and use its ID in the payload. If the name is not found after a fresh fetch, skip the priority field (it is not required) and show a user-friendly message: 'Test case created without priority, as given priority is not available in the current project.'",
|
|
78
247
|
"If the user provides a component name, fetch project info, find the matching component in customListObjs.component[index].name, and use its ID in the payload. If the name is not found, skip the component field (it is not required) and show a user-friendly message: 'Test case created without component, as given component is not available in the current project.'",
|
|
79
248
|
"If the user provides an owner name, fetch project info, find the matching owner in customListObjs.owner[index].name, and use its ID in the payload as testcaseOwner. If the name is not found, skip the testcaseOwner field (it is not required) and show a user-friendly message: 'Test case created without owner, as given owner is not available in the current project.'",
|
|
80
249
|
"If the user provides a test case state name, fetch project info, find the matching state in customListObjs.testCaseState[index].name, and use its ID in the payload as testCaseState. If the name is not found, skip the testCaseState field (it is not required) and show a user-friendly message: 'Test case created without test case state, as given state is not available in the current project.'",
|
|
@@ -82,7 +251,7 @@ const TESTCASE_TOOLS = [
|
|
|
82
251
|
"If the user provides a testing type name, fetch project info, find the matching type in customListObjs.testingType[index].name, and use its ID in the payload as testingType. If the name is not found, skip the testingType field (it is not required) and show a user-friendly message: 'Test case created without testing type, as given testing type is not available in the current project.'",
|
|
83
252
|
`Example: If user says 'Create test case with title "High priority test case" and set priority to "Blocker"', first call project info, map 'Blocker' to its ID, and use that ID for the priority field in the create payload. If user says 'set priority to "Urgent"' and 'Urgent' is not found, skip the priority field and show: 'Test case created without priority, as given priority is not available in the current project.'`,
|
|
84
253
|
"tcFolderID is required; use the root folder ID from project info or a specific folder.",
|
|
85
|
-
"
|
|
254
|
+
"STEPS: Omit steps from payload by default. Only include steps when user explicitly mentions them (SCENARIO 1) or stepSystemFields/stepFields has isMandatory=true (SCENARIO 2). See STEPS DECISION RULE at top of hints.",
|
|
86
255
|
"If the user provides a prompt like 'create test case with steps as step 1 - Go to login page, step 2 - give credential, step 3 - go to test case page, step 4 - create test case', LLM should parse each step and convert it into the steps payload array, mapping each step to an object with orderId, description, and optionally inputData and expectedOutcome.",
|
|
87
256
|
"Example mapping: 'step 1 - Go to login page' → { orderId: 1, description: 'Go to login page' }.",
|
|
88
257
|
"LLM should increment orderId for each step, use the step text as description, and optionally infer inputData/expectedOutcome if provided in the prompt.",
|
|
@@ -98,8 +267,38 @@ const TESTCASE_TOOLS = [
|
|
|
98
267
|
"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: 'Test case created without release/cycle association, as given release/cycle is not available in the current project.'",
|
|
99
268
|
"All IDs (priority, owner, etc.) must be valid for your QMetry instance.",
|
|
100
269
|
"If a custom field is mandatory, include it in the UDF object.",
|
|
101
|
-
"
|
|
102
|
-
"Description and testingType are optional but recommended for clarity."
|
|
270
|
+
"estimatedTime is in SECONDS (e.g. 3600 = 1 hour, 36000 = 10 hours). NOT minutes.",
|
|
271
|
+
"Description and testingType are optional but recommended for clarity.",
|
|
272
|
+
"",
|
|
273
|
+
"UDF (User Defined Fields) WORKFLOW FOR CREATE:",
|
|
274
|
+
"1. Call 'Fetch UDF Layout' with entityType='TC', pageName='ADD' to discover field names, types, list option IDs, and udfmID (projectUserFieldID).",
|
|
275
|
+
" 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.",
|
|
276
|
+
"2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
|
|
277
|
+
"3. For MULTILOOKUPLIST fields: pick an array of IDs from listOptions[field.listName][].id.",
|
|
278
|
+
"4. For CASCADINGLIST fields (ROOT-LEVEL UDF — MANDATORY STEPS):",
|
|
279
|
+
" a. MUST call 'Fetch Cascade Child Values' with parentId to get available child options (do NOT skip this step).",
|
|
280
|
+
" b. Pass the cascade value as: { parent: parentId, child: childId } in udfFields.",
|
|
281
|
+
" Example: udfFields: { project19: { parent: 5232623, child: 5232625 } }",
|
|
282
|
+
"5. For STRING/LARGETEXT/NUMBER/DATETIMEPICKER: pass value directly.",
|
|
283
|
+
"6. Pass all UDF values via 'udfFields' param: { fieldName: value }.",
|
|
284
|
+
"7. Mandatory UDF fields (isMandatory=true) MUST be included or create will fail.",
|
|
285
|
+
"",
|
|
286
|
+
"STEP UDFs: Pass step UDF values in each step's 'UDF' object.",
|
|
287
|
+
"Call 'Fetch UDF Layout' for stepFields to discover field names, types, and udfmID (projectUserFieldID).",
|
|
288
|
+
"Step UDF field types follow same rules as root UDF EXCEPT for CASCADINGLIST — step cascade requires a DIFFERENT format:",
|
|
289
|
+
"",
|
|
290
|
+
"STEP CASCADINGLIST UDF FORMAT (critical — different from root cascade):",
|
|
291
|
+
"For a cascade field named 'project19' with udfmID=2637584, parent={id:5232626, value:'React'}, child={id:5232628, value:'Redux'}:",
|
|
292
|
+
"You MUST include THREE keys inside the step's UDF object:",
|
|
293
|
+
" 1. fieldName: { parent: parentId, child: childId }",
|
|
294
|
+
" e.g. project19: { parent: 5232626, child: 5232628 }",
|
|
295
|
+
" 2. fieldName_value: [{ FieldID: 'fieldName', FieldValue: [{ id: parentId, value: 'parentLabel', child: { id: childId, value: 'childLabel' } }], type: 'CASCADINGLIST' }]",
|
|
296
|
+
" e.g. project19_value: [{ FieldID: 'project19', FieldValue: [{ id: 5232626, value: 'React', child: { id: 5232628, value: 'Redux' } }], type: 'CASCADINGLIST' }]",
|
|
297
|
+
" 3. fieldName_selectedList: { id: udfmID, name: 'fieldName', type: 'CASCADINGLIST' }",
|
|
298
|
+
" e.g. project19_selectedList: { id: 2637584, name: 'project19', type: 'CASCADINGLIST' }",
|
|
299
|
+
"To get parentLabel and childLabel: call 'Fetch Cascade Child Values' — it returns option labels alongside IDs.",
|
|
300
|
+
"udfmID comes from Fetch UDF Layout stepFields[].projectUserFieldID.",
|
|
301
|
+
"NEVER omit _value or _selectedList for step cascade fields — the API silently ignores cascade data without them."
|
|
103
302
|
],
|
|
104
303
|
outputDescription: "JSON object containing the new test case ID, summary, and creation metadata.",
|
|
105
304
|
readOnly: false,
|
|
@@ -336,6 +535,24 @@ const TESTCASE_TOOLS = [
|
|
|
336
535
|
}
|
|
337
536
|
],
|
|
338
537
|
hints: [
|
|
538
|
+
"=== DEFAULT VALUES — APPLY FOR ANY UNSET FIELD ===",
|
|
539
|
+
"Call 'Fetch UDF Layout' with entityType='TC', pageName='DETAIL' before updating.",
|
|
540
|
+
"defaultValues (from Fetch UDF Layout): { fieldName: defaultValueId } — sweep ALL entries.",
|
|
541
|
+
" For EACH key in defaultValues: if user did not explicitly provide that field → include it in payload with the default value.",
|
|
542
|
+
" This applies to non-mandatory fields too (e.g. priority, estimatedTime). Omitting them = data loss.",
|
|
543
|
+
"=== END DEFAULT VALUES ===",
|
|
544
|
+
"",
|
|
545
|
+
"=== DATE FORMAT CHECK (MANDATORY — EVERY UPDATE REQUEST) ===",
|
|
546
|
+
"ALWAYS call 'Fetch QMetry Project Info' before every update request — not only when the user explicitly mentions a date.",
|
|
547
|
+
"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).",
|
|
548
|
+
"STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
|
|
549
|
+
"STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
|
|
550
|
+
"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/...).",
|
|
551
|
+
" 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'",
|
|
552
|
+
"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.",
|
|
553
|
+
"NEVER assume a date format — always derive it from dateTimeFormatID. Wrong format = silent data loss.",
|
|
554
|
+
"=== END DATE FORMAT CHECK ===",
|
|
555
|
+
"",
|
|
339
556
|
"CRITICAL - VERSION CREATION vs UPDATE DISTINCTION:",
|
|
340
557
|
"This tool supports TWO MODES using the SAME API endpoint:",
|
|
341
558
|
"",
|
|
@@ -716,7 +933,19 @@ const TESTCASE_TOOLS = [
|
|
|
716
933
|
"",
|
|
717
934
|
"executionMinutes time is in minutes (legacy field).",
|
|
718
935
|
"estimatedTime is in seconds (preferred for version creation).",
|
|
719
|
-
"Description and testingType are optional but recommended for clarity."
|
|
936
|
+
"Description and testingType are optional but recommended for clarity.",
|
|
937
|
+
"",
|
|
938
|
+
"UDF (User Defined Fields) WORKFLOW FOR UPDATE:",
|
|
939
|
+
"1. Call 'Fetch UDF Layout' with entityType='TC', pageName='DETAIL' to get field names, fieldIDs (projectUserFieldID), and list option IDs.",
|
|
940
|
+
" 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.",
|
|
941
|
+
"2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
|
|
942
|
+
"3. For MULTILOOKUPLIST fields: pick an array of IDs; also pass the alias flat key (e.g., fieldNameAlias: 'Option Label').",
|
|
943
|
+
"4. For CASCADINGLIST fields: pick parent ID + fetch child with 'Fetch Cascade Child Values'. Pass { parent: parentId, child: childId }.",
|
|
944
|
+
"5. Pass BOTH 'udfFields' (flat root values) AND 'UDF' wrapper (with fieldID) — both required for update.",
|
|
945
|
+
" Example: udfFields: { custom_text: 'new value' }, UDF: { custom_text: { fieldID: 1001, value: 'new value' } }",
|
|
946
|
+
"6. Mandatory UDF fields (isMandatory=true) MUST be included.",
|
|
947
|
+
"STEP UDFs for update: Use same step UDF field names from 'Fetch UDF Layout' stepFields. Pass in each step's 'UDF' object.",
|
|
948
|
+
"For MULTILOOKUPLIST step UDFs in update: use { ADD: [id1, id2], REMOVE: [id3] } format."
|
|
720
949
|
],
|
|
721
950
|
outputDescription: "JSON object containing the test case ID, version ID, summary, update/creation metadata. When withVersion=true (version creation), response includes new version number and version ID. When withVersion=false/omitted (existing version update), response includes updated fields confirmation.",
|
|
722
951
|
readOnly: false,
|
|
@@ -1127,6 +1356,38 @@ const TESTCASE_TOOLS = [
|
|
|
1127
1356
|
outputDescription: "JSON object with executions array. Each execution record ALWAYS contains these mandatory identification fields: 'tsEntityKey' (Test Suite Key, e.g. 'MAC-TS-42'), 'testsuiteName' (Test Suite Name), 'releaseName' (Release), 'cycleName' (Cycle), 'platform' (Platform/environment), 'executedVersion' (Executed Version of the test case), 'executionStatus' (Execution Status label), 'tcRunID' (numeric Test Run ID), 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. Top-level 'hasTcRunUdf' flag indicates whether the project has Test Run UDFs configured. When false, a 'testRunUdfNote' field provides a professional explanation instead.",
|
|
1128
1357
|
readOnly: true,
|
|
1129
1358
|
idempotent: true
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
title: "Fetch Test Case Steps With UDF",
|
|
1362
|
+
toolset: "Test Cases",
|
|
1363
|
+
summary: "Fetch test case steps including UDF field values via viewColumns endpoint",
|
|
1364
|
+
handler: QMetryToolsHandlers.FETCH_TEST_CASE_STEPS_WITH_UDF,
|
|
1365
|
+
inputSchema: TestCaseStepsWithUdfArgsSchema,
|
|
1366
|
+
purpose: "Retrieve test case steps with full UDF data. Use this instead of 'Fetch Test Case Steps' when you need step-level UDF field values — the basic steps endpoint omits UDF data.",
|
|
1367
|
+
useCases: [
|
|
1368
|
+
"Get step UDF field values for a test case",
|
|
1369
|
+
"Retrieve steps with custom fields before updating step UDFs",
|
|
1370
|
+
"Inspect step-level UDF data for reporting"
|
|
1371
|
+
],
|
|
1372
|
+
examples: [
|
|
1373
|
+
{
|
|
1374
|
+
description: "Fetch steps with UDF values for test case ID 112768054",
|
|
1375
|
+
parameters: { tcID: 112768054 },
|
|
1376
|
+
expectedOutput: "Steps with UDF object containing field values, ID_<field> arrays for lookup IDs, UDF_<field> prefixed values, filterTemplate with UDF field definitions"
|
|
1377
|
+
}
|
|
1378
|
+
],
|
|
1379
|
+
hints: [
|
|
1380
|
+
"Response includes 'filterTemplate' array listing all UDF fields with their fieldType and udfmID",
|
|
1381
|
+
"UDF values in each step row: UDF_<fieldName> = display value, UDF_ID_<fieldName> = numeric IDs",
|
|
1382
|
+
"Step UDF object also has ID_<fieldName> for lookup IDs",
|
|
1383
|
+
"LOOKUPLIST: id = UDF_ID_<fieldName>, display = UDF_<fieldName>",
|
|
1384
|
+
"MULTILOOKUPLIST: ids = UDF_ID_<fieldName> (array), display = UDF_<fieldName>",
|
|
1385
|
+
"CASCADINGLIST: parent = UDF_ID_<fieldName>[0], child = UDF_ID_<fieldName>[1]",
|
|
1386
|
+
"viewId auto-resolved from project info if not provided"
|
|
1387
|
+
],
|
|
1388
|
+
outputDescription: "JSON object with data array (steps with UDF values), filterTemplate (UDF field definitions), columns (visible/hidden column config), total count, and viewId",
|
|
1389
|
+
readOnly: true,
|
|
1390
|
+
idempotent: true
|
|
1130
1391
|
}
|
|
1131
1392
|
];
|
|
1132
1393
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QMetryToolsHandlers } from "../../config/constants.js";
|
|
2
|
-
import { CreateTestSuiteArgsSchema, UpdateTestSuiteArgsSchema, TestSuiteListArgsSchema, TestSuitesForTestCaseArgsSchema, LinkTestCasesToTestSuiteArgsSchema, RequirementsLinkedTestCasesToTestSuiteArgsSchema, LinkPlatformsToTestSuiteArgsSchema, TestCasesByTestSuiteArgsSchema, ExecutionsByTestSuiteArgsSchema, TestCaseRunsByTestSuiteRunArgsSchema, BulkUpdateExecutionStatusArgsSchema } from "../../types/common.js";
|
|
2
|
+
import { CreateTestSuiteArgsSchema, UpdateTestSuiteArgsSchema, TestSuiteListArgsSchema, TestSuitesForTestCaseArgsSchema, LinkTestCasesToTestSuiteArgsSchema, RequirementsLinkedTestCasesToTestSuiteArgsSchema, LinkPlatformsToTestSuiteArgsSchema, TestCasesByTestSuiteArgsSchema, ExecutionsByTestSuiteArgsSchema, TestCaseRunsByTestSuiteRunArgsSchema, BulkUpdateExecutionStatusArgsSchema, FetchTestSuiteDetailsArgsSchema } from "../../types/common.js";
|
|
3
3
|
const TESTSUITE_TOOLS = [
|
|
4
4
|
{
|
|
5
5
|
title: "Create Test Suite",
|
|
@@ -7,7 +7,7 @@ const TESTSUITE_TOOLS = [
|
|
|
7
7
|
summary: "Create a new test suite in QMetry with metadata and release/cycle mapping.",
|
|
8
8
|
handler: QMetryToolsHandlers.CREATE_TEST_SUITE,
|
|
9
9
|
inputSchema: CreateTestSuiteArgsSchema,
|
|
10
|
-
purpose: "Allows users to create a new test suite in QMetry, including metadata and release/cycle mapping. Supports all major test suite fields. For fields like testsuiteOwner, testSuiteState, etc., fetch their valid values using the project info tool. If parentFolderId is not provided, it will be auto-resolved to the root test suite folder using project info.",
|
|
10
|
+
purpose: "REQUIRED WORKFLOW: Before calling this tool, ALWAYS call 'Fetch UDF Layout' (entityType='TS', 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 test suite in QMetry, including metadata and release/cycle mapping. Supports all major test suite fields. For fields like testsuiteOwner, testSuiteState, etc., fetch their valid values using the project info tool. If parentFolderId is not provided, it will be auto-resolved to the root test suite folder using project info.",
|
|
11
11
|
useCases: [
|
|
12
12
|
"Create a basic test suite with just a name and folder",
|
|
13
13
|
"Add detailed metadata like description to a test suite",
|
|
@@ -54,6 +54,78 @@ const TESTSUITE_TOOLS = [
|
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
56
|
hints: [
|
|
57
|
+
"╔══════════════════════════════════════════════════════════════════╗",
|
|
58
|
+
"║ STEP 0 — NON-NEGOTIABLE: Call 'Fetch UDF Layout' BEFORE create ║",
|
|
59
|
+
"╚══════════════════════════════════════════════════════════════════╝",
|
|
60
|
+
"NEVER call 'Create Test Suite' without first calling 'Fetch UDF Layout' with entityType='TS', pageName='ADD'.",
|
|
61
|
+
"Skipping this step WILL cause 400 errors (CO.MANDATORY_FIELDS_MISSING) because mandatory fields and defaults are unknown.",
|
|
62
|
+
"This rule has NO exceptions — not even when the user only provided a name and nothing else.",
|
|
63
|
+
"",
|
|
64
|
+
"=== MANDATORY PRE-CREATE CHECK (ALWAYS DO THIS FIRST) ===",
|
|
65
|
+
"Before creating any test suite, call 'Fetch UDF Layout' with entityType='TS', pageName='ADD'.",
|
|
66
|
+
"Response keys use 'TS' — same structure as TC but scoped to test suite module.",
|
|
67
|
+
"",
|
|
68
|
+
"SYSTEM FIELDS mandatory check — use 'systemFields' array (from qmSDF.TS in newlayout):",
|
|
69
|
+
" Each entry: { name, label, fieldTypeName, isMandatory }",
|
|
70
|
+
" isMandatory=true (allowBlank=false) means field MUST have a value before creating.",
|
|
71
|
+
"",
|
|
72
|
+
"UDF FIELDS mandatory check — use 'fields' array (from qmUDF.TS in newlayout):",
|
|
73
|
+
" Each entry: { name, label, fieldTypeName, isMandatory, listName? }",
|
|
74
|
+
" isMandatory=true means field MUST have a value.",
|
|
75
|
+
"",
|
|
76
|
+
"DEFAULT VALUES — use 'defaultValues' object (from qmDefaultValue.TS in newlayout):",
|
|
77
|
+
" Shape: { fieldName: defaultValueId } e.g. { 'priority': 5232497, 'estimatedTime': 18305 }",
|
|
78
|
+
" RULE: isMandatory=true AND defaultValues[field.name] exists → auto-use default, do NOT ask user.",
|
|
79
|
+
" RULE: isMandatory=true AND no defaultValues entry → MUST ask user before creating.",
|
|
80
|
+
" RULE: isMandatory=false AND defaultValues entry exists → auto-apply if user didn't specify.",
|
|
81
|
+
"",
|
|
82
|
+
"╔══════════════════════════════════════════════════════════════════════════╗",
|
|
83
|
+
"║ PRE-FLIGHT DEFAULT SWEEP — MANDATORY STEP BEFORE EVERY CREATE CALL ║",
|
|
84
|
+
"╚══════════════════════════════════════════════════════════════════════════╝",
|
|
85
|
+
"After resolving mandatory fields, sweep ALL defaultValues entries:",
|
|
86
|
+
" For EACH key in defaultValues:",
|
|
87
|
+
" IF the user did not explicitly provide that field → add it to the payload using the default value.",
|
|
88
|
+
" This applies regardless of isMandatory — non-mandatory defaults MUST also be auto-applied.",
|
|
89
|
+
" Example: defaultValues = { priority: 5232497, estimatedTime: 18305 }",
|
|
90
|
+
" → user only said 'create a test suite named X'",
|
|
91
|
+
" → payload MUST include: priority=5232497, estimatedTime=18305",
|
|
92
|
+
" → WRONG to omit priority/estimatedTime just because they are not mandatory — they have defaults.",
|
|
93
|
+
" Skipping this sweep = missing fields in the created record = user-visible data loss.",
|
|
94
|
+
"╚══════════════════════════════════════════════════════════════════════════╝",
|
|
95
|
+
"",
|
|
96
|
+
"DECISION MATRIX:",
|
|
97
|
+
" | isMandatory | Has default | Action |",
|
|
98
|
+
" |-------------|-------------|-------------------------------------|",
|
|
99
|
+
" | true | YES | Auto-fill with default, no ask |",
|
|
100
|
+
" | true | NO | Ask user before creating |",
|
|
101
|
+
" | false | YES | Auto-fill with default — REQUIRED |",
|
|
102
|
+
" | false | NO | Skip if user didn't provide |",
|
|
103
|
+
"Only after ALL mandatory fields resolved AND default sweep complete → proceed with create.",
|
|
104
|
+
"=== END MANDATORY PRE-CREATE CHECK ===",
|
|
105
|
+
"",
|
|
106
|
+
"=== ERROR RECOVERY: CO.MANDATORY_FIELDS_MISSING ===",
|
|
107
|
+
"If create fails with error code 'CO.MANDATORY_FIELDS_MISSING', DO NOT give up. Auto-recover:",
|
|
108
|
+
" 1. Parse the 'MISSING_FIELDS' list from the error response (comma-separated field labels).",
|
|
109
|
+
" 2. Match each label against 'fields[].label' and 'systemFields[].label' from the Fetch UDF Layout response.",
|
|
110
|
+
" 3. For matched UDF fields: check 'listOptions[field.listName]' for valid option IDs.",
|
|
111
|
+
" 4. For matched system fields (e.g. 'Status'): check 'customListObjs.testSuiteState' from project info.",
|
|
112
|
+
" 5. If the field has a 'defaultValues' entry: auto-fill it silently.",
|
|
113
|
+
" 6. If no default exists: ask the user ONLY for the missing fields by label.",
|
|
114
|
+
" 7. Retry create with the resolved values added to the payload.",
|
|
115
|
+
" NEVER ask user to 'try again' manually — resolve and retry automatically.",
|
|
116
|
+
"=== END ERROR RECOVERY ===",
|
|
117
|
+
"",
|
|
118
|
+
"=== DATE FORMAT CHECK (MANDATORY — EVERY CREATE REQUEST) ===",
|
|
119
|
+
"ALWAYS call 'Fetch QMetry Project Info' before every create request — not only when the user explicitly mentions a date.",
|
|
120
|
+
"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).",
|
|
121
|
+
"STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
|
|
122
|
+
"STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
|
|
123
|
+
"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/...).",
|
|
124
|
+
" 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'",
|
|
125
|
+
"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.",
|
|
126
|
+
"NEVER assume a date format — always derive it from dateTimeFormatID. Wrong format = silent data loss.",
|
|
127
|
+
"=== END DATE FORMAT CHECK ===",
|
|
128
|
+
"",
|
|
57
129
|
"If parentFolderId is not provided, it will be auto-resolved to the root test suite folder using project info (rootFolders.TS.id).",
|
|
58
130
|
"To get valid values for testsuiteOwner, testSuiteState, etc., call the 'Admin/Get info Service' API (FETCH_PROJECT_INFO tool) and use the returned customListObjs IDs.",
|
|
59
131
|
"CRITICAL: For testsuiteOwner mapping - Call API 'Admin/Get info Service', from the response get value from customListObjs.owner[<index>].id. Match the user by customListObjs.owner[<index>].name.",
|
|
@@ -71,7 +143,29 @@ const TESTSUITE_TOOLS = [
|
|
|
71
143
|
"Example: For 'Air' release and 'Air Q1-19' cycle in MAC project, use releaseId: 10286 and buildID: 18411",
|
|
72
144
|
"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: 'Test suite created without release/cycle association, as given release/cycle is not available in the current project.'",
|
|
73
145
|
"All IDs (testSuiteState from customListObjs.testSuiteState[index].id, testsuiteOwner from customListObjs.owner[index].id, releaseId from projects.releases[index].releaseID, buildID from projects.releases.builds[index].buildID) must be valid for your QMetry instance.",
|
|
74
|
-
"If a custom field is mandatory, include it in the UDF object."
|
|
146
|
+
"If a custom field is mandatory, include it in the UDF object.",
|
|
147
|
+
"",
|
|
148
|
+
"UDF (User Defined Fields) WORKFLOW FOR CREATE:",
|
|
149
|
+
"1. Call 'Fetch UDF Layout' with entityType='TS', pageName='ADD' to discover field names, types, and list option IDs.",
|
|
150
|
+
" 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.",
|
|
151
|
+
"2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
|
|
152
|
+
"3. For MULTILOOKUPLIST fields: pick an array of IDs.",
|
|
153
|
+
"4. For CASCADINGLIST fields: pick parent ID, then call 'Fetch Cascade Child Values' for child ID. Pass { parent: parentId, child: childId }.",
|
|
154
|
+
"5. Pass all UDF values via 'udfFields' param: { fieldName: value }.",
|
|
155
|
+
"6. Mandatory UDF fields (isMandatory=true) MUST be included or create will fail.",
|
|
156
|
+
"",
|
|
157
|
+
"╔══════════════════════════════════════════════════════════════════╗",
|
|
158
|
+
"║ POST-CREATE MANDATORY: Link Platform to Test Suite ║",
|
|
159
|
+
"╚══════════════════════════════════════════════════════════════════╝",
|
|
160
|
+
"AFTER every successful test suite creation, ALWAYS call 'Link Platforms to Test Suite'.",
|
|
161
|
+
"Reason: QMetry UI enforces platform association — test suites without a linked platform",
|
|
162
|
+
"are invalid for execution and will show validation errors in the UI.",
|
|
163
|
+
"STEP 1: Call 'Fetch Platforms' to get available platforms for the project.",
|
|
164
|
+
"STEP 2: If the user specified a platform, match by name and use its platformID.",
|
|
165
|
+
" If no platform was specified, use the first available non-archived platform.",
|
|
166
|
+
"STEP 3: Call 'Link Platforms to Test Suite' with qmTsId=<new suite id> and qmPlatformId=<platformID>.",
|
|
167
|
+
"NEVER report the test suite as successfully created without completing this platform link step.",
|
|
168
|
+
"╚══════════════════════════════════════════════════════════════════╝"
|
|
75
169
|
],
|
|
76
170
|
outputDescription: "JSON object containing the new test suite ID, summary, and creation metadata.",
|
|
77
171
|
readOnly: false,
|
|
@@ -83,7 +177,7 @@ const TESTSUITE_TOOLS = [
|
|
|
83
177
|
summary: "Update an existing QMetry test suite by id(testsuite numeric id), with auto-resolution from entityKey.",
|
|
84
178
|
handler: QMetryToolsHandlers.UPDATE_TEST_SUITE,
|
|
85
179
|
inputSchema: UpdateTestSuiteArgsSchema,
|
|
86
|
-
purpose: "Update a QMetry test suite's metadata, description, or other fields. Requires id(testsuite numeric id), which can be auto-resolved from the test suite entityKey using the test suite list tools. Supports updating name, description, owner, state, and more. Only fields provided will be updated.",
|
|
180
|
+
purpose: "REQUIRED WORKFLOW: Before calling this tool, call 'Fetch UDF Layout' (entityType='TS', 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 a QMetry test suite's metadata, description, or other fields. Requires id(testsuite numeric id), which can be auto-resolved from the test suite entityKey using the test suite list tools. Supports updating name, description, owner, state, and more. Only fields provided will be updated.",
|
|
87
181
|
useCases: [
|
|
88
182
|
"Update test suite summary (name)",
|
|
89
183
|
"Change owner, or state of a test suite",
|
|
@@ -124,6 +218,26 @@ const TESTSUITE_TOOLS = [
|
|
|
124
218
|
}
|
|
125
219
|
],
|
|
126
220
|
hints: [
|
|
221
|
+
"=== DEFAULT VALUES — APPLY FOR ANY UNSET FIELD ===",
|
|
222
|
+
"ALWAYS call 'Fetch UDF Layout' with entityType='TS', pageName='DETAIL' before updating.",
|
|
223
|
+
"defaultValues (from Fetch UDF Layout): { fieldName: defaultValueId } — sweep ALL entries.",
|
|
224
|
+
" For EACH key in defaultValues: if user did not explicitly provide that field → include it in payload with the default value.",
|
|
225
|
+
" This applies to non-mandatory fields too (e.g. testSuiteState). Omitting them = data loss.",
|
|
226
|
+
"systemFields (from qmSDF.TS): isMandatory=true fields must retain a valid value after update.",
|
|
227
|
+
"fields/UDF (from qmUDF.TS): isMandatory=true UDF fields must be included if being changed.",
|
|
228
|
+
"=== END DEFAULT VALUES ===",
|
|
229
|
+
"",
|
|
230
|
+
"=== DATE FORMAT CHECK (MANDATORY — EVERY UPDATE REQUEST) ===",
|
|
231
|
+
"ALWAYS call 'Fetch QMetry Project Info' before every update request — not only when the user explicitly mentions a date.",
|
|
232
|
+
"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).",
|
|
233
|
+
"STEP 1: From project info, read dateTimeFormatID (e.g. 3).",
|
|
234
|
+
"STEP 2: Find entry in dateTimeFormatNew where id === dateTimeFormatID → read its unique_value (e.g. 'yyyy-MM-dd').",
|
|
235
|
+
"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/...).",
|
|
236
|
+
" 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'",
|
|
237
|
+
"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.",
|
|
238
|
+
"NEVER assume a date format — always derive it from dateTimeFormatID. Wrong format = silent data loss.",
|
|
239
|
+
"=== END DATE FORMAT CHECK ===",
|
|
240
|
+
"",
|
|
127
241
|
"If user provides entityKey (e.g., MAC-TS-7), first call Fetch Test Suites with a filter on entityKeyId to resolve the id (test suite numeric id) and TsFolderID from rootFolders.TS.id.",
|
|
128
242
|
"To get valid values for owner, state, etc., call the 'Admin/Get info Service' API (FETCH_PROJECT_INFO tool) and use the returned customListObjs IDs.",
|
|
129
243
|
"CRITICAL: For testsuiteOwner mapping - Call API 'Admin/Get info Service', from the response get value from customListObjs.owner[<index>].id. Match the user by customListObjs.owner[<index>].name.",
|
|
@@ -133,7 +247,17 @@ const TESTSUITE_TOOLS = [
|
|
|
133
247
|
"If either owner or state is not found in project info, the update for that field will be skipped and a user-friendly message will be shown to the user.",
|
|
134
248
|
"UDF fields in steps must match your QMetry custom field configuration.",
|
|
135
249
|
"All IDs (testSuiteState from customListObjs.testSuiteState[index].id, testsuiteOwner from customListObjs.owner[index].id) must be valid for your QMetry instance.",
|
|
136
|
-
"If a custom field is mandatory, include it in the UDF object."
|
|
250
|
+
"If a custom field is mandatory, include it in the UDF object.",
|
|
251
|
+
"",
|
|
252
|
+
"UDF (User Defined Fields) WORKFLOW FOR UPDATE:",
|
|
253
|
+
"1. Call 'Fetch UDF Layout' with entityType='TS', pageName='DETAIL' to get field names, fieldIDs (projectUserFieldID), and list option IDs.",
|
|
254
|
+
" 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.",
|
|
255
|
+
"2. For LOOKUPLIST fields: pick one ID from listOptions[field.listName][].id.",
|
|
256
|
+
"3. For MULTILOOKUPLIST fields: pick array of IDs; also pass alias flat key (e.g., fieldNameAlias: 'Option Label').",
|
|
257
|
+
"4. For CASCADINGLIST fields: pick parent ID + fetch child with 'Fetch Cascade Child Values'. Pass { parent: parentId, child: childId }.",
|
|
258
|
+
"5. Pass BOTH 'udfFields' (flat root values) AND 'UDF' wrapper (with fieldID) — both required for update.",
|
|
259
|
+
" Example: udfFields: { ts_field: 'value' }, UDF: { ts_field: { fieldID: 2001, value: 'value' } }",
|
|
260
|
+
"6. Mandatory UDF fields (isMandatory=true) MUST be included."
|
|
137
261
|
],
|
|
138
262
|
outputDescription: "JSON object containing the new test suite ID, summary, and creation metadata.",
|
|
139
263
|
readOnly: false,
|
|
@@ -1341,6 +1465,29 @@ const TESTSUITE_TOOLS = [
|
|
|
1341
1465
|
outputDescription: "JSON object with success status, updated execution details, and confirmation message",
|
|
1342
1466
|
readOnly: false,
|
|
1343
1467
|
idempotent: false
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
title: "Fetch Test Suite Details",
|
|
1471
|
+
toolset: "Test Suites",
|
|
1472
|
+
summary: "Fetch full detail data for a QMetry test suite including UDF field values",
|
|
1473
|
+
handler: QMetryToolsHandlers.FETCH_TEST_SUITE_DETAILS,
|
|
1474
|
+
inputSchema: FetchTestSuiteDetailsArgsSchema,
|
|
1475
|
+
purpose: "Get complete test suite details including UDF values. Use this when you need UDF field data for a test suite — the list API (Fetch Test Suites) omits UDF values.",
|
|
1476
|
+
useCases: [
|
|
1477
|
+
"Get UDF field values for a specific test suite",
|
|
1478
|
+
"Retrieve full test suite metadata including custom fields",
|
|
1479
|
+
"Inspect test suite details before updating UDF values"
|
|
1480
|
+
],
|
|
1481
|
+
examples: [
|
|
1482
|
+
{
|
|
1483
|
+
description: "Fetch details for test suite with ID 142013",
|
|
1484
|
+
parameters: { id: 142013 },
|
|
1485
|
+
expectedOutput: "Full test suite detail object with UDFTypeData, UDF field values, and metadata"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
outputDescription: "JSON object with full test suite details including UDFTypeData map and all UDF field values",
|
|
1489
|
+
readOnly: true,
|
|
1490
|
+
idempotent: true
|
|
1344
1491
|
}
|
|
1345
1492
|
];
|
|
1346
1493
|
export {
|