@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,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Steps Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing shared steps in Qase.
|
|
5
|
+
* Shared steps are reusable test steps that can be included in multiple test cases.
|
|
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, HashSchema } from '../utils/validation.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for shared step content
|
|
17
|
+
*/
|
|
18
|
+
const SharedStepContentSchema = z.object({
|
|
19
|
+
action: z.string().describe('Step action description'),
|
|
20
|
+
expected_result: z.string().optional().describe('Expected result'),
|
|
21
|
+
data: z.string().optional().describe('Test data'),
|
|
22
|
+
attachments: z.array(z.string()).optional().describe('Array of attachment hashes'),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Schema for listing shared steps
|
|
26
|
+
*/
|
|
27
|
+
const ListSharedStepsSchema = z.object({
|
|
28
|
+
code: ProjectCodeSchema,
|
|
29
|
+
search: z.string().optional().describe('Search query for step title'),
|
|
30
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
31
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Schema for getting a specific shared step
|
|
35
|
+
*/
|
|
36
|
+
const GetSharedStepSchema = z.object({
|
|
37
|
+
code: ProjectCodeSchema,
|
|
38
|
+
hash: HashSchema.describe('Shared step hash identifier'),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Schema for creating a shared step
|
|
42
|
+
*/
|
|
43
|
+
const CreateSharedStepSchema = z.object({
|
|
44
|
+
code: ProjectCodeSchema,
|
|
45
|
+
title: z.string().min(1).max(255).describe('Shared step title'),
|
|
46
|
+
steps: z.array(SharedStepContentSchema).optional().describe('Array of step definitions'),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Schema for updating a shared step
|
|
50
|
+
*/
|
|
51
|
+
const UpdateSharedStepSchema = z.object({
|
|
52
|
+
code: ProjectCodeSchema,
|
|
53
|
+
hash: HashSchema.describe('Shared step hash identifier'),
|
|
54
|
+
title: z.string().min(1).max(255).optional().describe('Shared step title'),
|
|
55
|
+
steps: z.array(SharedStepContentSchema).optional().describe('Array of step definitions'),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Schema for deleting a shared step
|
|
59
|
+
*/
|
|
60
|
+
const DeleteSharedStepSchema = z.object({
|
|
61
|
+
code: ProjectCodeSchema,
|
|
62
|
+
hash: HashSchema.describe('Shared step hash identifier'),
|
|
63
|
+
});
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// HANDLERS
|
|
66
|
+
// ============================================================================
|
|
67
|
+
/**
|
|
68
|
+
* List all shared steps in a project
|
|
69
|
+
*/
|
|
70
|
+
async function listSharedSteps(args) {
|
|
71
|
+
const client = getApiClient();
|
|
72
|
+
const { code, search, limit, offset } = args;
|
|
73
|
+
const result = await toResultAsync(client.sharedSteps.getSharedSteps(code, search, limit, offset));
|
|
74
|
+
return result.match((response) => response.data.result, (error) => {
|
|
75
|
+
throw new Error(error);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get a specific shared step
|
|
80
|
+
*/
|
|
81
|
+
async function getSharedStep(args) {
|
|
82
|
+
const client = getApiClient();
|
|
83
|
+
const { code, hash } = args;
|
|
84
|
+
const result = await toResultAsync(client.sharedSteps.getSharedStep(code, hash));
|
|
85
|
+
return result.match((response) => response.data.result, (error) => {
|
|
86
|
+
throw new Error(error);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a new shared step
|
|
91
|
+
*/
|
|
92
|
+
async function createSharedStep(args) {
|
|
93
|
+
const client = getApiClient();
|
|
94
|
+
const { code, ...stepData } = args;
|
|
95
|
+
const result = await toResultAsync(client.sharedSteps.createSharedStep(code, stepData));
|
|
96
|
+
return result.match((response) => response.data.result, (error) => {
|
|
97
|
+
throw new Error(error);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Update an existing shared step
|
|
102
|
+
*/
|
|
103
|
+
async function updateSharedStep(args) {
|
|
104
|
+
const client = getApiClient();
|
|
105
|
+
const { code, hash, ...updateData } = args;
|
|
106
|
+
const result = await toResultAsync(client.sharedSteps.updateSharedStep(code, hash, updateData));
|
|
107
|
+
return result.match((response) => response.data.result, (error) => {
|
|
108
|
+
throw new Error(error);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Delete a shared step
|
|
113
|
+
*/
|
|
114
|
+
async function deleteSharedStep(args) {
|
|
115
|
+
const client = getApiClient();
|
|
116
|
+
const { code, hash } = args;
|
|
117
|
+
const result = await toResultAsync(client.sharedSteps.deleteSharedStep(code, hash));
|
|
118
|
+
return result.match((_response) => ({ success: true, hash }), (error) => {
|
|
119
|
+
throw new Error(error);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// ============================================================================
|
|
123
|
+
// TOOL REGISTRATION
|
|
124
|
+
// ============================================================================
|
|
125
|
+
toolRegistry.register({
|
|
126
|
+
name: 'list_shared_steps',
|
|
127
|
+
description: 'Get all shared steps in a project with optional search and pagination',
|
|
128
|
+
schema: ListSharedStepsSchema,
|
|
129
|
+
handler: listSharedSteps,
|
|
130
|
+
});
|
|
131
|
+
toolRegistry.register({
|
|
132
|
+
name: 'get_shared_step',
|
|
133
|
+
description: 'Get a specific shared step by project code and hash',
|
|
134
|
+
schema: GetSharedStepSchema,
|
|
135
|
+
handler: getSharedStep,
|
|
136
|
+
});
|
|
137
|
+
toolRegistry.register({
|
|
138
|
+
name: 'create_shared_step',
|
|
139
|
+
description: 'Create a new reusable shared step in a project',
|
|
140
|
+
schema: CreateSharedStepSchema,
|
|
141
|
+
handler: createSharedStep,
|
|
142
|
+
});
|
|
143
|
+
toolRegistry.register({
|
|
144
|
+
name: 'update_shared_step',
|
|
145
|
+
description: 'Update an existing shared step',
|
|
146
|
+
schema: UpdateSharedStepSchema,
|
|
147
|
+
handler: updateSharedStep,
|
|
148
|
+
});
|
|
149
|
+
toolRegistry.register({
|
|
150
|
+
name: 'delete_shared_step',
|
|
151
|
+
description: 'Delete a shared step from a project',
|
|
152
|
+
schema: DeleteSharedStepSchema,
|
|
153
|
+
handler: deleteSharedStep,
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=shared-steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-steps.js","sourceRoot":"","sources":["../../src/operations/shared-steps.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,iBAAiB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/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MAAM,EAAE,mBAAmB;IAC3B,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,gDAAgD;IAC7D,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,gCAAgC;IAC7C,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qCAAqC;IAClD,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.d.ts","sourceRoot":"","sources":["../../src/operations/suites.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Suites Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing test suites in Qase.
|
|
5
|
+
* Suites provide organizational hierarchy for test cases.
|
|
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 suites
|
|
17
|
+
*/
|
|
18
|
+
const ListSuitesSchema = z.object({
|
|
19
|
+
code: ProjectCodeSchema,
|
|
20
|
+
search: z.string().optional().describe('Search query for suite title'),
|
|
21
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
22
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Schema for getting a specific test suite
|
|
26
|
+
*/
|
|
27
|
+
const GetSuiteSchema = z.object({
|
|
28
|
+
code: ProjectCodeSchema,
|
|
29
|
+
id: IdSchema,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Schema for creating a test suite
|
|
33
|
+
*/
|
|
34
|
+
const CreateSuiteSchema = z.object({
|
|
35
|
+
code: ProjectCodeSchema,
|
|
36
|
+
title: z.string().min(1).max(255).describe('Suite title'),
|
|
37
|
+
description: z.string().optional().describe('Suite description'),
|
|
38
|
+
preconditions: z.string().optional().describe('Preconditions for tests in this suite'),
|
|
39
|
+
parent_id: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.positive()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Parent suite ID for creating nested suites'),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Schema for updating a test suite
|
|
48
|
+
*/
|
|
49
|
+
const UpdateSuiteSchema = z.object({
|
|
50
|
+
code: ProjectCodeSchema,
|
|
51
|
+
id: IdSchema,
|
|
52
|
+
title: z.string().min(1).max(255).optional().describe('Suite title'),
|
|
53
|
+
description: z.string().optional().describe('Suite description'),
|
|
54
|
+
preconditions: z.string().optional().describe('Preconditions for tests in this suite'),
|
|
55
|
+
parent_id: z
|
|
56
|
+
.number()
|
|
57
|
+
.int()
|
|
58
|
+
.positive()
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('Parent suite ID for moving the suite'),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Schema for deleting a test suite
|
|
64
|
+
*/
|
|
65
|
+
const DeleteSuiteSchema = z.object({
|
|
66
|
+
code: ProjectCodeSchema,
|
|
67
|
+
id: IdSchema,
|
|
68
|
+
delete_cases: z
|
|
69
|
+
.boolean()
|
|
70
|
+
.optional()
|
|
71
|
+
.describe('If true, delete all test cases in the suite. If false, move cases to parent suite or root.'),
|
|
72
|
+
});
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// HANDLERS
|
|
75
|
+
// ============================================================================
|
|
76
|
+
/**
|
|
77
|
+
* List all test suites in a project
|
|
78
|
+
*/
|
|
79
|
+
async function listSuites(args) {
|
|
80
|
+
const client = getApiClient();
|
|
81
|
+
const { code, search, limit, offset } = args;
|
|
82
|
+
const result = await toResultAsync(client.suites.getSuites(code, search, limit, offset));
|
|
83
|
+
return result.match((response) => response.data.result, (error) => {
|
|
84
|
+
throw new Error(error);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a specific test suite
|
|
89
|
+
*/
|
|
90
|
+
async function getSuite(args) {
|
|
91
|
+
const client = getApiClient();
|
|
92
|
+
const { code, id } = args;
|
|
93
|
+
const result = await toResultAsync(client.suites.getSuite(code, id));
|
|
94
|
+
return result.match((response) => response.data.result, (error) => {
|
|
95
|
+
throw new Error(error);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create a new test suite
|
|
100
|
+
*/
|
|
101
|
+
async function createSuite(args) {
|
|
102
|
+
const client = getApiClient();
|
|
103
|
+
const { code, ...suiteData } = args;
|
|
104
|
+
const result = await toResultAsync(client.suites.createSuite(code, suiteData));
|
|
105
|
+
return result.match((response) => response.data.result, (error) => {
|
|
106
|
+
throw new Error(error);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Update an existing test suite
|
|
111
|
+
*/
|
|
112
|
+
async function updateSuite(args) {
|
|
113
|
+
const client = getApiClient();
|
|
114
|
+
const { code, id, ...updateData } = args;
|
|
115
|
+
const result = await toResultAsync(client.suites.updateSuite(code, id, updateData));
|
|
116
|
+
return result.match((response) => response.data.result, (error) => {
|
|
117
|
+
throw new Error(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Delete a test suite
|
|
122
|
+
*/
|
|
123
|
+
async function deleteSuite(args) {
|
|
124
|
+
const client = getApiClient();
|
|
125
|
+
const { code, id, delete_cases } = args;
|
|
126
|
+
const result = await toResultAsync(client.suites.deleteSuite(code, id));
|
|
127
|
+
return result.match((_response) => ({ success: true, id, delete_cases }), (error) => {
|
|
128
|
+
throw new Error(error);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// TOOL REGISTRATION
|
|
133
|
+
// ============================================================================
|
|
134
|
+
toolRegistry.register({
|
|
135
|
+
name: 'list_suites',
|
|
136
|
+
description: 'Get all test suites in a project with optional search and pagination',
|
|
137
|
+
schema: ListSuitesSchema,
|
|
138
|
+
handler: listSuites,
|
|
139
|
+
});
|
|
140
|
+
toolRegistry.register({
|
|
141
|
+
name: 'get_suite',
|
|
142
|
+
description: 'Get a specific test suite by project code and suite ID',
|
|
143
|
+
schema: GetSuiteSchema,
|
|
144
|
+
handler: getSuite,
|
|
145
|
+
});
|
|
146
|
+
toolRegistry.register({
|
|
147
|
+
name: 'create_suite',
|
|
148
|
+
description: 'Create a new test suite in a project',
|
|
149
|
+
schema: CreateSuiteSchema,
|
|
150
|
+
handler: createSuite,
|
|
151
|
+
});
|
|
152
|
+
toolRegistry.register({
|
|
153
|
+
name: 'update_suite',
|
|
154
|
+
description: 'Update an existing test suite',
|
|
155
|
+
schema: UpdateSuiteSchema,
|
|
156
|
+
handler: updateSuite,
|
|
157
|
+
});
|
|
158
|
+
toolRegistry.register({
|
|
159
|
+
name: 'delete_suite',
|
|
160
|
+
description: 'Delete a test suite from a project',
|
|
161
|
+
schema: DeleteSuiteSchema,
|
|
162
|
+
handler: deleteSuite,
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=suites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.js","sourceRoot":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AAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,sEAAsE;IACnF,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,UAAU;CACpB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,wDAAwD;IACrE,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,sCAAsC;IACnD,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,+BAA+B;IAC5C,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,oCAAoC;IACjD,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-fields.d.ts","sourceRoot":"","sources":["../../src/operations/system-fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Fields Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for viewing system field configurations in Qase.
|
|
5
|
+
* System fields are built-in fields that can be configured at the account level.
|
|
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
|
+
// ============================================================================
|
|
12
|
+
// SCHEMAS
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Schema for listing system fields (no parameters needed)
|
|
16
|
+
*/
|
|
17
|
+
const ListSystemFieldsSchema = z.object({});
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// HANDLERS
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* List all system fields and their configurations
|
|
23
|
+
*/
|
|
24
|
+
async function listSystemFields(_args) {
|
|
25
|
+
const client = getApiClient();
|
|
26
|
+
const result = await toResultAsync(client.systemFields.getSystemFields());
|
|
27
|
+
return result.match((response) => response.data.result, (error) => {
|
|
28
|
+
throw new Error(error);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// TOOL REGISTRATION
|
|
33
|
+
// ============================================================================
|
|
34
|
+
toolRegistry.register({
|
|
35
|
+
name: 'list_system_fields',
|
|
36
|
+
description: 'Get all system field configurations (built-in fields like priority, severity, etc.)',
|
|
37
|
+
schema: ListSystemFieldsSchema,
|
|
38
|
+
handler: listSystemFields,
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=system-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-fields.js","sourceRoot":"","sources":["../../src/operations/system-fields.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;AAEnD,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE5C,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAAC,KAA6C;IAC3E,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAE,MAAc,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC;IAEnF,OAAO,MAAM,CAAC,KAAK,CACjB,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EACvC,CAAC,KAAK,EAAE,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,qFAAqF;IACvF,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/operations/users.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Users Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing users in Qase.
|
|
5
|
+
* Users are team members with access to the Qase workspace.
|
|
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 users
|
|
17
|
+
*/
|
|
18
|
+
const ListUsersSchema = 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 user
|
|
24
|
+
*/
|
|
25
|
+
const GetUserSchema = z.object({
|
|
26
|
+
id: IdSchema,
|
|
27
|
+
});
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// HANDLERS
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* List all users
|
|
33
|
+
*/
|
|
34
|
+
async function listUsers(args) {
|
|
35
|
+
const client = getApiClient();
|
|
36
|
+
const { limit, offset } = args;
|
|
37
|
+
const result = await toResultAsync(client.users.getUsers(limit, offset));
|
|
38
|
+
return result.match((response) => response.data.result, (error) => {
|
|
39
|
+
throw new Error(error);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a specific user
|
|
44
|
+
*/
|
|
45
|
+
async function getUser(args) {
|
|
46
|
+
const client = getApiClient();
|
|
47
|
+
const { id } = args;
|
|
48
|
+
const result = await toResultAsync(client.users.getUser(id));
|
|
49
|
+
return result.match((response) => response.data.result, (error) => {
|
|
50
|
+
throw new Error(error);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// TOOL REGISTRATION
|
|
55
|
+
// ============================================================================
|
|
56
|
+
toolRegistry.register({
|
|
57
|
+
name: 'list_users',
|
|
58
|
+
description: 'Get all users in the workspace with optional pagination',
|
|
59
|
+
schema: ListUsersSchema,
|
|
60
|
+
handler: listUsers,
|
|
61
|
+
});
|
|
62
|
+
toolRegistry.register({
|
|
63
|
+
name: 'get_user',
|
|
64
|
+
description: 'Get a specific user by ID',
|
|
65
|
+
schema: GetUserSchema,
|
|
66
|
+
handler: getUser,
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EACvC,CAAC,KAAK,EAAE,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,OAAO,CAAC,IAAmC;IACxD,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAEpB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAE,MAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAEtE,OAAO,MAAM,CAAC,KAAK,CACjB,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EACvC,CAAC,KAAK,EAAE,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,yDAAyD;IACtE,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,2BAA2B;IACxC,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom TypeScript Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Central location for type definitions used across the application:
|
|
5
|
+
* - MCP-related types
|
|
6
|
+
* - API response types
|
|
7
|
+
* - Re-exports from external libraries
|
|
8
|
+
*/
|
|
9
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* MCP Tool type alias for convenience
|
|
13
|
+
*/
|
|
14
|
+
export type McpTool = Tool;
|
|
15
|
+
/**
|
|
16
|
+
* Generic API response wrapper from Qase API
|
|
17
|
+
* All Qase API responses follow this structure
|
|
18
|
+
*/
|
|
19
|
+
export interface ApiResponse<T> {
|
|
20
|
+
status: boolean;
|
|
21
|
+
result: T;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Paginated API response wrapper
|
|
25
|
+
*/
|
|
26
|
+
export interface PaginatedApiResponse<T> {
|
|
27
|
+
status: boolean;
|
|
28
|
+
result: {
|
|
29
|
+
total: number;
|
|
30
|
+
filtered: number;
|
|
31
|
+
count: number;
|
|
32
|
+
entities: T[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tool handler function type
|
|
37
|
+
* All tool handlers must implement this signature
|
|
38
|
+
*/
|
|
39
|
+
export type ToolHandler<T extends z.ZodTypeAny> = (args: z.infer<T>) => Promise<unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Tool definition for registration
|
|
42
|
+
*/
|
|
43
|
+
export interface ToolDefinition<T extends z.ZodTypeAny> {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
schema: T;
|
|
47
|
+
handler: ToolHandler<T>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC;AAE3B;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,CAAC,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,EAAE,CAAC;KACf,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom TypeScript Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Central location for type definitions used across the application:
|
|
5
|
+
* - MCP-related types
|
|
6
|
+
* - API response types
|
|
7
|
+
* - Re-exports from external libraries
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
// Re-export common types from qaseio as they become needed
|
|
11
|
+
// These will be populated as we implement various operations
|
|
12
|
+
// export type { ... } from 'qaseio';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAgDH,2DAA2D;AAC3D,6DAA6D;AAC7D,qCAAqC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive error handling for Qase API interactions:
|
|
5
|
+
* - Custom error classes
|
|
6
|
+
* - Error formatting with user-friendly messages
|
|
7
|
+
* - Type guards for specific error types
|
|
8
|
+
* - Integration with neverthrow Result type
|
|
9
|
+
*/
|
|
10
|
+
import { ResultAsync } from 'neverthrow';
|
|
11
|
+
/**
|
|
12
|
+
* Custom error class for Qase API errors
|
|
13
|
+
*/
|
|
14
|
+
export declare class QaseApiError extends Error {
|
|
15
|
+
statusCode?: number | undefined;
|
|
16
|
+
errorCode?: string | undefined;
|
|
17
|
+
details?: unknown | undefined;
|
|
18
|
+
constructor(message: string, statusCode?: number | undefined, errorCode?: string | undefined, details?: unknown | undefined);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Format API error into a user-friendly message
|
|
22
|
+
*
|
|
23
|
+
* @param error - The error to format
|
|
24
|
+
* @returns Formatted error message
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatApiError(error: unknown): string;
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if an error is an authentication error (401)
|
|
29
|
+
*
|
|
30
|
+
* @param error - The error to check
|
|
31
|
+
* @returns True if the error is a 401 authentication error
|
|
32
|
+
*/
|
|
33
|
+
export declare function isAuthenticationError(error: unknown): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if an error is a not found error (404)
|
|
36
|
+
*
|
|
37
|
+
* @param error - The error to check
|
|
38
|
+
* @returns True if the error is a 404 not found error
|
|
39
|
+
*/
|
|
40
|
+
export declare function isNotFoundError(error: unknown): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Type guard to check if an error is a validation error (400 or 422)
|
|
43
|
+
*
|
|
44
|
+
* @param error - The error to check
|
|
45
|
+
* @returns True if the error is a validation error
|
|
46
|
+
*/
|
|
47
|
+
export declare function isValidationError(error: unknown): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Type guard to check if an error is a rate limit error (429)
|
|
50
|
+
*
|
|
51
|
+
* @param error - The error to check
|
|
52
|
+
* @returns True if the error is a rate limit error
|
|
53
|
+
*/
|
|
54
|
+
export declare function isRateLimitError(error: unknown): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Helper to wrap promises in neverthrow Result type
|
|
57
|
+
*
|
|
58
|
+
* Converts Promise<T> to ResultAsync<T, string> with formatted error messages
|
|
59
|
+
*
|
|
60
|
+
* @param promise - The promise to wrap
|
|
61
|
+
* @returns ResultAsync with formatted error on rejection
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const result = await toResultAsync(apiClient.projects.getProjects());
|
|
66
|
+
* result.match(
|
|
67
|
+
* (projects) => console.log(projects),
|
|
68
|
+
* (error) => console.error(error)
|
|
69
|
+
* );
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function toResultAsync<T>(promise: Promise<T>): ResultAsync<T, string>;
|
|
73
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAG5B,UAAU,CAAC,EAAE,MAAM;IACnB,SAAS,CAAC,EAAE,MAAM;IAClB,OAAO,CAAC,EAAE,OAAO;gBAHxB,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,SAAS,CAAC,EAAE,MAAM,YAAA,EAClB,OAAO,CAAC,EAAE,OAAO,YAAA;CAM3B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA4CrD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAE5E"}
|