@qase/mcp-server 1.0.0-beta.1
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/CHANGELOG.md +165 -0
- package/README.md +450 -0
- package/build/client/index.d.ts +23 -0
- package/build/client/index.d.ts.map +1 -0
- package/build/client/index.js +55 -0
- package/build/client/index.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +125 -0
- package/build/index.js.map +1 -0
- package/build/operations/attachments.d.ts +8 -0
- package/build/operations/attachments.d.ts.map +1 -0
- package/build/operations/attachments.js +123 -0
- package/build/operations/attachments.js.map +1 -0
- package/build/operations/authors.d.ts +8 -0
- package/build/operations/authors.d.ts.map +1 -0
- package/build/operations/authors.js +68 -0
- package/build/operations/authors.js.map +1 -0
- package/build/operations/cases.d.ts +8 -0
- package/build/operations/cases.d.ts.map +1 -0
- package/build/operations/cases.js +278 -0
- package/build/operations/cases.js.map +1 -0
- package/build/operations/configurations.d.ts +8 -0
- package/build/operations/configurations.d.ts.map +1 -0
- package/build/operations/configurations.js +102 -0
- package/build/operations/configurations.js.map +1 -0
- package/build/operations/custom-fields.d.ts +8 -0
- package/build/operations/custom-fields.d.ts.map +1 -0
- package/build/operations/custom-fields.js +167 -0
- package/build/operations/custom-fields.js.map +1 -0
- package/build/operations/defects.d.ts +8 -0
- package/build/operations/defects.d.ts.map +1 -0
- package/build/operations/defects.js +219 -0
- package/build/operations/defects.js.map +1 -0
- package/build/operations/environments.d.ts +8 -0
- package/build/operations/environments.d.ts.map +1 -0
- package/build/operations/environments.js +149 -0
- package/build/operations/environments.js.map +1 -0
- package/build/operations/milestones.d.ts +8 -0
- package/build/operations/milestones.d.ts.map +1 -0
- package/build/operations/milestones.js +150 -0
- package/build/operations/milestones.js.map +1 -0
- package/build/operations/plans.d.ts +8 -0
- package/build/operations/plans.d.ts.map +1 -0
- package/build/operations/plans.js +153 -0
- package/build/operations/plans.js.map +1 -0
- package/build/operations/projects.d.ts +8 -0
- package/build/operations/projects.d.ts.map +1 -0
- package/build/operations/projects.js +186 -0
- package/build/operations/projects.js.map +1 -0
- package/build/operations/results.d.ts +8 -0
- package/build/operations/results.d.ts.map +1 -0
- package/build/operations/results.js +208 -0
- package/build/operations/results.js.map +1 -0
- package/build/operations/runs.d.ts +8 -0
- package/build/operations/runs.d.ts.map +1 -0
- package/build/operations/runs.js +211 -0
- package/build/operations/runs.js.map +1 -0
- package/build/operations/search.d.ts +8 -0
- package/build/operations/search.d.ts.map +1 -0
- package/build/operations/search.js +138 -0
- package/build/operations/search.js.map +1 -0
- package/build/operations/shared-parameters.d.ts +8 -0
- package/build/operations/shared-parameters.d.ts.map +1 -0
- package/build/operations/shared-parameters.js +139 -0
- package/build/operations/shared-parameters.js.map +1 -0
- package/build/operations/shared-steps.d.ts +8 -0
- package/build/operations/shared-steps.d.ts.map +1 -0
- package/build/operations/shared-steps.js +155 -0
- package/build/operations/shared-steps.js.map +1 -0
- package/build/operations/suites.d.ts +8 -0
- package/build/operations/suites.d.ts.map +1 -0
- package/build/operations/suites.js +164 -0
- package/build/operations/suites.js.map +1 -0
- package/build/operations/system-fields.d.ts +8 -0
- package/build/operations/system-fields.d.ts.map +1 -0
- package/build/operations/system-fields.js +40 -0
- package/build/operations/system-fields.js.map +1 -0
- package/build/operations/users.d.ts +8 -0
- package/build/operations/users.d.ts.map +1 -0
- package/build/operations/users.js +68 -0
- package/build/operations/users.js.map +1 -0
- package/build/types/index.d.ts +49 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +13 -0
- package/build/types/index.js.map +1 -0
- package/build/utils/errors.d.ts +73 -0
- package/build/utils/errors.d.ts.map +1 -0
- package/build/utils/errors.js +136 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/qql-helpers.d.ts +59 -0
- package/build/utils/qql-helpers.d.ts.map +1 -0
- package/build/utils/qql-helpers.js +85 -0
- package/build/utils/qql-helpers.js.map +1 -0
- package/build/utils/registry.d.ts +97 -0
- package/build/utils/registry.d.ts.map +1 -0
- package/build/utils/registry.js +132 -0
- package/build/utils/registry.js.map +1 -0
- package/build/utils/test-helpers.d.ts +32 -0
- package/build/utils/test-helpers.d.ts.map +1 -0
- package/build/utils/test-helpers.js +81 -0
- package/build/utils/test-helpers.js.map +1 -0
- package/build/utils/validation.d.ts +107 -0
- package/build/utils/validation.d.ts.map +1 -0
- package/build/utils/validation.js +104 -0
- package/build/utils/validation.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Runs Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing test runs in Qase.
|
|
5
|
+
* Test runs represent test execution sessions.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getApiClient } from '../client/index.js';
|
|
9
|
+
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
+
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { ProjectCodeSchema, IdSchema } from '../utils/validation.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for listing test runs
|
|
17
|
+
*/
|
|
18
|
+
const ListRunsSchema = z.object({
|
|
19
|
+
code: ProjectCodeSchema,
|
|
20
|
+
search: z.string().optional().describe('Search query for run title'),
|
|
21
|
+
status: z.string().optional().describe('Filter by status (e.g., "active", "complete")'),
|
|
22
|
+
milestone: z.number().int().positive().optional().describe('Filter by milestone ID'),
|
|
23
|
+
environment: z.number().int().positive().optional().describe('Filter by environment ID'),
|
|
24
|
+
from_start_time: z.number().optional().describe('Filter runs started after this timestamp'),
|
|
25
|
+
to_start_time: z.number().optional().describe('Filter runs started before this timestamp'),
|
|
26
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
27
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
28
|
+
include: z.string().optional().describe('Comma-separated relations to include (e.g., "cases")'),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Schema for getting a specific test run
|
|
32
|
+
*/
|
|
33
|
+
const GetRunSchema = z.object({
|
|
34
|
+
code: ProjectCodeSchema,
|
|
35
|
+
id: IdSchema,
|
|
36
|
+
include: z.string().optional().describe('Comma-separated relations to include (e.g., "cases")'),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Schema for creating a test run
|
|
40
|
+
*/
|
|
41
|
+
const CreateRunSchema = z.object({
|
|
42
|
+
code: ProjectCodeSchema,
|
|
43
|
+
title: z.string().min(1).max(255).describe('Test run title'),
|
|
44
|
+
description: z.string().optional().describe('Test run description'),
|
|
45
|
+
environment_id: z.number().int().positive().optional().describe('Environment ID for this run'),
|
|
46
|
+
milestone_id: z.number().int().positive().optional().describe('Milestone ID for this run'),
|
|
47
|
+
plan_id: z.number().int().positive().optional().describe('Test plan ID to base this run on'),
|
|
48
|
+
cases: z
|
|
49
|
+
.array(z.number().int().positive())
|
|
50
|
+
.optional()
|
|
51
|
+
.describe('Array of test case IDs to include in the run'),
|
|
52
|
+
is_autotest: z.boolean().optional().describe('Mark as automated test run'),
|
|
53
|
+
start_time: z.number().optional().describe('Start time as unix timestamp'),
|
|
54
|
+
end_time: z.number().optional().describe('End time as unix timestamp'),
|
|
55
|
+
custom_field: z.record(z.any()).optional().describe('Custom field values'),
|
|
56
|
+
tags: z.array(z.string()).optional().describe('Tags for categorization'),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Schema for deleting a test run
|
|
60
|
+
*/
|
|
61
|
+
const DeleteRunSchema = z.object({
|
|
62
|
+
code: ProjectCodeSchema,
|
|
63
|
+
id: IdSchema,
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Schema for completing a test run
|
|
67
|
+
*/
|
|
68
|
+
const CompleteRunSchema = z.object({
|
|
69
|
+
code: ProjectCodeSchema,
|
|
70
|
+
id: IdSchema,
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Schema for getting run public link
|
|
74
|
+
*/
|
|
75
|
+
const GetRunPublicLinkSchema = z.object({
|
|
76
|
+
code: ProjectCodeSchema,
|
|
77
|
+
id: IdSchema,
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Schema for deleting run public link
|
|
81
|
+
*/
|
|
82
|
+
const DeleteRunPublicLinkSchema = z.object({
|
|
83
|
+
code: ProjectCodeSchema,
|
|
84
|
+
id: IdSchema,
|
|
85
|
+
});
|
|
86
|
+
// ============================================================================
|
|
87
|
+
// HANDLERS
|
|
88
|
+
// ============================================================================
|
|
89
|
+
/**
|
|
90
|
+
* List all test runs in a project
|
|
91
|
+
*/
|
|
92
|
+
async function listRuns(args) {
|
|
93
|
+
const client = getApiClient();
|
|
94
|
+
const { code, ...filters } = args;
|
|
95
|
+
const result = await toResultAsync(client.runs.getRuns(code, filters.search, filters.status, filters.milestone, filters.environment, filters.from_start_time, filters.to_start_time, filters.limit, filters.offset, filters.include));
|
|
96
|
+
return result.match((response) => response.data.result, (error) => {
|
|
97
|
+
throw new Error(error);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get a specific test run
|
|
102
|
+
*/
|
|
103
|
+
async function getRun(args) {
|
|
104
|
+
const client = getApiClient();
|
|
105
|
+
const { code, id, include } = args;
|
|
106
|
+
const result = await toResultAsync(client.runs.getRun(code, id, include));
|
|
107
|
+
return result.match((response) => response.data.result, (error) => {
|
|
108
|
+
throw new Error(error);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create a new test run
|
|
113
|
+
*/
|
|
114
|
+
async function createRun(args) {
|
|
115
|
+
const client = getApiClient();
|
|
116
|
+
const { code, ...runData } = args;
|
|
117
|
+
const result = await toResultAsync(client.runs.createRun(code, runData));
|
|
118
|
+
return result.match((response) => response.data.result, (error) => {
|
|
119
|
+
throw new Error(error);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Delete a test run
|
|
124
|
+
*/
|
|
125
|
+
async function deleteRun(args) {
|
|
126
|
+
const client = getApiClient();
|
|
127
|
+
const { code, id } = args;
|
|
128
|
+
const result = await toResultAsync(client.runs.deleteRun(code, id));
|
|
129
|
+
return result.match((_response) => ({ success: true, id }), (error) => {
|
|
130
|
+
throw new Error(error);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Complete a test run
|
|
135
|
+
*/
|
|
136
|
+
async function completeRun(args) {
|
|
137
|
+
const client = getApiClient();
|
|
138
|
+
const { code, id } = args;
|
|
139
|
+
const result = await toResultAsync(client.runs.completeRun(code, id));
|
|
140
|
+
return result.match((_response) => ({ success: true, id, status: 'complete' }), (error) => {
|
|
141
|
+
throw new Error(error);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get or create public link for a test run
|
|
146
|
+
*/
|
|
147
|
+
async function getRunPublicLink(args) {
|
|
148
|
+
const client = getApiClient();
|
|
149
|
+
const { code, id } = args;
|
|
150
|
+
const result = await toResultAsync(client.runs.updateRunPublicity(code, id, { status: true }));
|
|
151
|
+
return result.match((response) => response.data.result, (error) => {
|
|
152
|
+
throw new Error(error);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Delete public link for a test run
|
|
157
|
+
*/
|
|
158
|
+
async function deleteRunPublicLink(args) {
|
|
159
|
+
const client = getApiClient();
|
|
160
|
+
const { code, id } = args;
|
|
161
|
+
const result = await toResultAsync(client.runs.updateRunPublicity(code, id, { status: false }));
|
|
162
|
+
return result.match((_response) => ({ success: true, id, public_link_removed: true }), (error) => {
|
|
163
|
+
throw new Error(error);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// ============================================================================
|
|
167
|
+
// TOOL REGISTRATION
|
|
168
|
+
// ============================================================================
|
|
169
|
+
toolRegistry.register({
|
|
170
|
+
name: 'list_runs',
|
|
171
|
+
description: 'Get all test runs in a project with optional filtering and pagination',
|
|
172
|
+
schema: ListRunsSchema,
|
|
173
|
+
handler: listRuns,
|
|
174
|
+
});
|
|
175
|
+
toolRegistry.register({
|
|
176
|
+
name: 'get_run',
|
|
177
|
+
description: 'Get a specific test run by project code and run ID',
|
|
178
|
+
schema: GetRunSchema,
|
|
179
|
+
handler: getRun,
|
|
180
|
+
});
|
|
181
|
+
toolRegistry.register({
|
|
182
|
+
name: 'create_run',
|
|
183
|
+
description: 'Create a new test run in a project',
|
|
184
|
+
schema: CreateRunSchema,
|
|
185
|
+
handler: createRun,
|
|
186
|
+
});
|
|
187
|
+
toolRegistry.register({
|
|
188
|
+
name: 'delete_run',
|
|
189
|
+
description: 'Delete a test run from a project',
|
|
190
|
+
schema: DeleteRunSchema,
|
|
191
|
+
handler: deleteRun,
|
|
192
|
+
});
|
|
193
|
+
toolRegistry.register({
|
|
194
|
+
name: 'complete_run',
|
|
195
|
+
description: 'Mark a test run as complete',
|
|
196
|
+
schema: CompleteRunSchema,
|
|
197
|
+
handler: completeRun,
|
|
198
|
+
});
|
|
199
|
+
toolRegistry.register({
|
|
200
|
+
name: 'get_run_public_link',
|
|
201
|
+
description: 'Get or create a public link for sharing a test run externally',
|
|
202
|
+
schema: GetRunPublicLinkSchema,
|
|
203
|
+
handler: getRunPublicLink,
|
|
204
|
+
});
|
|
205
|
+
toolRegistry.register({
|
|
206
|
+
name: 'delete_run_public_link',
|
|
207
|
+
description: 'Delete the public link for a test run',
|
|
208
|
+
schema: DeleteRunPublicLinkSchema,
|
|
209
|
+
handler: deleteRunPublicLink,
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/operations/runs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,M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operations/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QQL Search Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements QQL (Qase Query Language) search functionality.
|
|
5
|
+
* QQL enables powerful cross-project querying with complex filters.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getApiClient } from '../client/index.js';
|
|
9
|
+
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
+
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { QqlExamples } from '../utils/qql-helpers.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for QQL search
|
|
17
|
+
*/
|
|
18
|
+
const QqlSearchSchema = z.object({
|
|
19
|
+
query: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.max(1000)
|
|
23
|
+
.describe('QQL query expression. Examples:\n' +
|
|
24
|
+
'- entity = "case" and project = "DEMO" and status = "Actual"\n' +
|
|
25
|
+
'- entity = "defect" and severity = "blocker" and status = "open"\n' +
|
|
26
|
+
'- entity = "result" and status = "failed" and created >= now("-7d")\n' +
|
|
27
|
+
'- entity = "run" and milestone ~ "Sprint 12"\n' +
|
|
28
|
+
'See QQL documentation for full syntax and examples.'),
|
|
29
|
+
limit: z
|
|
30
|
+
.number()
|
|
31
|
+
.int()
|
|
32
|
+
.positive()
|
|
33
|
+
.max(100)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Maximum number of results to return (default: 10, max: 100)'),
|
|
36
|
+
offset: z
|
|
37
|
+
.number()
|
|
38
|
+
.int()
|
|
39
|
+
.nonnegative()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('Number of results to skip for pagination'),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Schema for QQL help
|
|
45
|
+
*/
|
|
46
|
+
const GetQqlHelpSchema = z.object({
|
|
47
|
+
topic: z
|
|
48
|
+
.enum(['syntax', 'entities', 'operators', 'functions', 'examples'])
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Specific help topic, or omit for general overview'),
|
|
51
|
+
});
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// HANDLERS
|
|
54
|
+
// ============================================================================
|
|
55
|
+
/**
|
|
56
|
+
* Execute QQL search query
|
|
57
|
+
*/
|
|
58
|
+
async function qqlSearch(args) {
|
|
59
|
+
const client = getApiClient();
|
|
60
|
+
const { query, limit, offset } = args;
|
|
61
|
+
const result = await toResultAsync(client.search({
|
|
62
|
+
query,
|
|
63
|
+
limit: limit || 10,
|
|
64
|
+
offset: offset || 0,
|
|
65
|
+
}));
|
|
66
|
+
return result.match((response) => ({
|
|
67
|
+
total: response.data.result.total,
|
|
68
|
+
filtered: response.data.result.filtered,
|
|
69
|
+
count: response.data.result.count,
|
|
70
|
+
entities: response.data.result.entities,
|
|
71
|
+
}), (error) => {
|
|
72
|
+
throw new Error(error);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get QQL help and documentation
|
|
77
|
+
*/
|
|
78
|
+
async function getQqlHelp(args) {
|
|
79
|
+
const { topic } = args;
|
|
80
|
+
const help = {
|
|
81
|
+
overview: {
|
|
82
|
+
description: 'QQL (Qase Query Language) allows powerful searches across Qase entities',
|
|
83
|
+
structure: 'entity = "TYPE" and CONDITION [and CONDITION...] [ORDER BY field ASC/DESC]',
|
|
84
|
+
entities: ['case', 'defect', 'run', 'result', 'plan', 'requirement'],
|
|
85
|
+
note: 'QQL is only available in Business and Enterprise Qase subscriptions',
|
|
86
|
+
},
|
|
87
|
+
syntax: {
|
|
88
|
+
basicStructure: 'entity = "TYPE" and CONDITION [and CONDITION...]',
|
|
89
|
+
ordering: 'ORDER BY field ASC/DESC',
|
|
90
|
+
customFields: 'cf["Field Name"] = value',
|
|
91
|
+
caseNotes: 'Queries are case-sensitive for field values',
|
|
92
|
+
stringMatching: '~ operator is case-insensitive substring match',
|
|
93
|
+
},
|
|
94
|
+
entities: {
|
|
95
|
+
case: 'Test cases - entity = "case"',
|
|
96
|
+
defect: 'Defects/bugs - entity = "defect"',
|
|
97
|
+
run: 'Test runs - entity = "run"',
|
|
98
|
+
result: 'Test results - entity = "result"',
|
|
99
|
+
plan: 'Test plans - entity = "plan"',
|
|
100
|
+
requirement: 'Requirements - entity = "requirement"',
|
|
101
|
+
},
|
|
102
|
+
operators: {
|
|
103
|
+
comparison: ['=', '!=', '<', '<=', '>', '>='],
|
|
104
|
+
string: ['~', 'is', 'is not'],
|
|
105
|
+
array: ['in', 'not in'],
|
|
106
|
+
null: ['is empty', 'is not empty'],
|
|
107
|
+
logical: ['and', 'or', 'not'],
|
|
108
|
+
},
|
|
109
|
+
functions: {
|
|
110
|
+
currentUser: 'currentUser() - Returns current user ID',
|
|
111
|
+
activeUsers: 'activeUsers() - Returns all active user IDs',
|
|
112
|
+
now: 'now("+/-Nd/w/m") - Current timestamp with optional offset (d=days, w=weeks, m=months)',
|
|
113
|
+
startOfDay: 'startOfDay("YYYY-MM-DD") - Start of specified day',
|
|
114
|
+
endOfDay: 'endOfDay("YYYY-MM-DD") - End of specified day',
|
|
115
|
+
},
|
|
116
|
+
examples: QqlExamples,
|
|
117
|
+
};
|
|
118
|
+
if (topic) {
|
|
119
|
+
return { topic, content: help[topic] };
|
|
120
|
+
}
|
|
121
|
+
return help;
|
|
122
|
+
}
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// TOOL REGISTRATION
|
|
125
|
+
// ============================================================================
|
|
126
|
+
toolRegistry.register({
|
|
127
|
+
name: 'qql_search',
|
|
128
|
+
description: 'Search entities using Qase Query Language (QQL) with powerful filtering and cross-project queries',
|
|
129
|
+
schema: QqlSearchSchema,
|
|
130
|
+
handler: qqlSearch,
|
|
131
|
+
});
|
|
132
|
+
toolRegistry.register({
|
|
133
|
+
name: 'qql_help',
|
|
134
|
+
description: 'Get help and examples for Qase Query Language (QQL) syntax',
|
|
135
|
+
schema: GetQqlHelpSchema,
|
|
136
|
+
handler: getQqlHelp,
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/operations/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CACP,mCAAmC;QACjC,gEAAgE;QAChE,oEAAoE;QACpE,uEAAuE;QACvE,gDAAgD;QAChD,qDAAqD,CACxD;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6DAA6D,CAAC;IAC1E,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;CACxD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC;SACL,IAAI,CAAC,CAAC,QAAQ,EAAE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,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,UAAU;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-parameters.d.ts","sourceRoot":"","sources":["../../src/operations/shared-parameters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Parameters Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing shared parameters in Qase.
|
|
5
|
+
* Shared parameters are reusable parameters for data-driven testing.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getApiClient } from '../client/index.js';
|
|
9
|
+
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
+
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { IdSchema } from '../utils/validation.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for listing shared parameters
|
|
17
|
+
*/
|
|
18
|
+
const ListSharedParametersSchema = z.object({
|
|
19
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
20
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Schema for getting a specific shared parameter
|
|
24
|
+
*/
|
|
25
|
+
const GetSharedParameterSchema = z.object({
|
|
26
|
+
id: IdSchema,
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Schema for creating a shared parameter
|
|
30
|
+
*/
|
|
31
|
+
const CreateSharedParameterSchema = z.object({
|
|
32
|
+
title: z.string().min(1).max(255).describe('Shared parameter title'),
|
|
33
|
+
values: z.array(z.string()).min(1).describe('Array of parameter values'),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Schema for updating a shared parameter
|
|
37
|
+
*/
|
|
38
|
+
const UpdateSharedParameterSchema = z.object({
|
|
39
|
+
id: IdSchema,
|
|
40
|
+
title: z.string().min(1).max(255).optional().describe('Shared parameter title'),
|
|
41
|
+
values: z.array(z.string()).min(1).optional().describe('Array of parameter values'),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Schema for deleting a shared parameter
|
|
45
|
+
*/
|
|
46
|
+
const DeleteSharedParameterSchema = z.object({
|
|
47
|
+
id: IdSchema,
|
|
48
|
+
});
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// HANDLERS
|
|
51
|
+
// ============================================================================
|
|
52
|
+
/**
|
|
53
|
+
* List all shared parameters
|
|
54
|
+
*/
|
|
55
|
+
async function listSharedParameters(args) {
|
|
56
|
+
const client = getApiClient();
|
|
57
|
+
const { limit, offset } = args;
|
|
58
|
+
const result = await toResultAsync(client.parameters.getParameters(limit, offset));
|
|
59
|
+
return result.match((response) => response.data.result, (error) => {
|
|
60
|
+
throw new Error(error);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get a specific shared parameter
|
|
65
|
+
*/
|
|
66
|
+
async function getSharedParameter(args) {
|
|
67
|
+
const client = getApiClient();
|
|
68
|
+
const { id } = args;
|
|
69
|
+
const result = await toResultAsync(client.parameters.getParameter(id));
|
|
70
|
+
return result.match((response) => response.data.result, (error) => {
|
|
71
|
+
throw new Error(error);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a new shared parameter
|
|
76
|
+
*/
|
|
77
|
+
async function createSharedParameter(args) {
|
|
78
|
+
const client = getApiClient();
|
|
79
|
+
const result = await toResultAsync(client.parameters.createParameter(args));
|
|
80
|
+
return result.match((response) => response.data.result, (error) => {
|
|
81
|
+
throw new Error(error);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Update an existing shared parameter
|
|
86
|
+
*/
|
|
87
|
+
async function updateSharedParameter(args) {
|
|
88
|
+
const client = getApiClient();
|
|
89
|
+
const { id, ...updateData } = args;
|
|
90
|
+
const result = await toResultAsync(client.parameters.updateParameter(id, updateData));
|
|
91
|
+
return result.match((response) => response.data.result, (error) => {
|
|
92
|
+
throw new Error(error);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Delete a shared parameter
|
|
97
|
+
*/
|
|
98
|
+
async function deleteSharedParameter(args) {
|
|
99
|
+
const client = getApiClient();
|
|
100
|
+
const { id } = args;
|
|
101
|
+
const result = await toResultAsync(client.parameters.deleteParameter(id));
|
|
102
|
+
return result.match((_response) => ({ success: true, id }), (error) => {
|
|
103
|
+
throw new Error(error);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// ============================================================================
|
|
107
|
+
// TOOL REGISTRATION
|
|
108
|
+
// ============================================================================
|
|
109
|
+
toolRegistry.register({
|
|
110
|
+
name: 'list_shared_parameters',
|
|
111
|
+
description: 'Get all shared parameters with optional pagination',
|
|
112
|
+
schema: ListSharedParametersSchema,
|
|
113
|
+
handler: listSharedParameters,
|
|
114
|
+
});
|
|
115
|
+
toolRegistry.register({
|
|
116
|
+
name: 'get_shared_parameter',
|
|
117
|
+
description: 'Get a specific shared parameter by ID',
|
|
118
|
+
schema: GetSharedParameterSchema,
|
|
119
|
+
handler: getSharedParameter,
|
|
120
|
+
});
|
|
121
|
+
toolRegistry.register({
|
|
122
|
+
name: 'create_shared_parameter',
|
|
123
|
+
description: 'Create a new shared parameter for data-driven testing',
|
|
124
|
+
schema: CreateSharedParameterSchema,
|
|
125
|
+
handler: createSharedParameter,
|
|
126
|
+
});
|
|
127
|
+
toolRegistry.register({
|
|
128
|
+
name: 'update_shared_parameter',
|
|
129
|
+
description: 'Update an existing shared parameter',
|
|
130
|
+
schema: UpdateSharedParameterSchema,
|
|
131
|
+
handler: updateSharedParameter,
|
|
132
|
+
});
|
|
133
|
+
toolRegistry.register({
|
|
134
|
+
name: 'delete_shared_parameter',
|
|
135
|
+
description: 'Delete a shared parameter',
|
|
136
|
+
schema: DeleteSharedParameterSchema,
|
|
137
|
+
handler: deleteSharedParameter,
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=shared-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-parameters.js","sourceRoot":"","sources":["../../src/operations/shared-parameters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC1F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CACtF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,QAAQ;CACb,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,C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