@zereight/mcp-gitlab 2.3.22 → 2.3.23-next.209
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/README.ko.md +4 -0
- package/README.md +4 -0
- package/README.pt-BR.md +4 -0
- package/README.zh-CN.md +4 -0
- package/build/index.js +42 -664
- package/build/tools/labels.js +175 -0
- package/build/tools/milestones.js +541 -0
- package/package.json +1 -1
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CreateGroupMilestoneSchema, CreateProjectMilestoneSchema, DeleteGroupMilestoneSchema, DeleteProjectMilestoneSchema, EditGroupMilestoneSchema, EditProjectMilestoneSchema, GetGroupMilestoneBurndownEventsSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetProjectMilestoneSchema, GitLabGroupMilestonesSchema, GitLabIssueSchema, GitLabMergeRequestSchema, GitLabMilestonesSchema, ListGroupMilestonesSchema, ListProjectMilestonesSchema, PromoteProjectMilestoneSchema, } from "../schemas.js";
|
|
3
|
+
import { getEffectiveApiUrl, getFetchConfig } from "../server/gitlab-request-context.js";
|
|
4
|
+
import { appendFilterParams, dropBlankArrayEntries, isBlankFilterValue, } from "../utils/tool-args.js";
|
|
5
|
+
import { encodeGitLabPathSegment } from "../utils/url.js";
|
|
6
|
+
let deps;
|
|
7
|
+
export function configureMilestoneTools(next) {
|
|
8
|
+
deps = next;
|
|
9
|
+
}
|
|
10
|
+
function requireDeps() {
|
|
11
|
+
if (!deps) {
|
|
12
|
+
throw new Error("Milestone tools used before configureMilestoneTools()");
|
|
13
|
+
}
|
|
14
|
+
return deps;
|
|
15
|
+
}
|
|
16
|
+
const fetch = (input, init) => requireDeps().getFetch()(input, init);
|
|
17
|
+
function handleGitLabError(response) {
|
|
18
|
+
return requireDeps().handleGitLabError(response);
|
|
19
|
+
}
|
|
20
|
+
function getEffectiveProjectId(projectId) {
|
|
21
|
+
return requireDeps().getEffectiveProjectId(projectId);
|
|
22
|
+
}
|
|
23
|
+
function rejectIfStrictProjectScope(toolName) {
|
|
24
|
+
requireDeps().rejectIfStrictProjectScope(toolName);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* List project milestones in a GitLab project
|
|
28
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
29
|
+
* @param {Object} options - Options for listing milestones
|
|
30
|
+
* @returns {Promise<GitLabMilestones[]>} List of milestones
|
|
31
|
+
*/
|
|
32
|
+
async function listProjectMilestones(projectId, options) {
|
|
33
|
+
projectId = decodeURIComponent(projectId);
|
|
34
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
35
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
36
|
+
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
37
|
+
const normalized = dropBlankArrayEntries(value);
|
|
38
|
+
if (isBlankFilterValue(normalized)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (key === "iids" && Array.isArray(normalized)) {
|
|
42
|
+
normalized.forEach(iid => {
|
|
43
|
+
url.searchParams.append("iids[]", String(iid));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
url.searchParams.append(key, String(normalized));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const response = await fetch(url.toString(), {
|
|
51
|
+
...getFetchConfig(),
|
|
52
|
+
});
|
|
53
|
+
await handleGitLabError(response);
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
return z.array(GitLabMilestonesSchema).parse(data);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a single milestone in a GitLab project
|
|
59
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
60
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
61
|
+
* @returns {Promise<GitLabMilestones>} Milestone details
|
|
62
|
+
*/
|
|
63
|
+
async function getProjectMilestone(projectId, milestoneId) {
|
|
64
|
+
projectId = decodeURIComponent(projectId);
|
|
65
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
66
|
+
const response = await fetch(url.toString(), {
|
|
67
|
+
...getFetchConfig(),
|
|
68
|
+
});
|
|
69
|
+
await handleGitLabError(response);
|
|
70
|
+
const data = await response.json();
|
|
71
|
+
return GitLabMilestonesSchema.parse(data);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new milestone in a GitLab project
|
|
75
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
76
|
+
* @param {Object} options - Options for creating a milestone
|
|
77
|
+
* @returns {Promise<GitLabMilestones>} Created milestone
|
|
78
|
+
*/
|
|
79
|
+
async function createProjectMilestone(projectId, options) {
|
|
80
|
+
projectId = decodeURIComponent(projectId);
|
|
81
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
82
|
+
const response = await fetch(url.toString(), {
|
|
83
|
+
...getFetchConfig(),
|
|
84
|
+
method: "POST",
|
|
85
|
+
body: JSON.stringify(options),
|
|
86
|
+
});
|
|
87
|
+
await handleGitLabError(response);
|
|
88
|
+
const data = await response.json();
|
|
89
|
+
return GitLabMilestonesSchema.parse(data);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Edit an existing milestone in a GitLab project
|
|
93
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
94
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
95
|
+
* @param {Object} options - Options for editing a milestone
|
|
96
|
+
* @returns {Promise<GitLabMilestones>} Updated milestone
|
|
97
|
+
*/
|
|
98
|
+
async function editProjectMilestone(projectId, milestoneId, options) {
|
|
99
|
+
projectId = decodeURIComponent(projectId);
|
|
100
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
101
|
+
const response = await fetch(url.toString(), {
|
|
102
|
+
...getFetchConfig(),
|
|
103
|
+
method: "PUT",
|
|
104
|
+
body: JSON.stringify(options),
|
|
105
|
+
});
|
|
106
|
+
await handleGitLabError(response);
|
|
107
|
+
const data = await response.json();
|
|
108
|
+
return GitLabMilestonesSchema.parse(data);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Delete a milestone from a GitLab project
|
|
112
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
113
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
114
|
+
* @returns {Promise<void>}
|
|
115
|
+
*/
|
|
116
|
+
async function deleteProjectMilestone(projectId, milestoneId) {
|
|
117
|
+
projectId = decodeURIComponent(projectId);
|
|
118
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
119
|
+
const response = await fetch(url.toString(), {
|
|
120
|
+
...getFetchConfig(),
|
|
121
|
+
method: "DELETE",
|
|
122
|
+
});
|
|
123
|
+
await handleGitLabError(response);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get all issues assigned to a single milestone
|
|
127
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
128
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
129
|
+
* @returns {Promise<GitLabIssue[]>} List of issues
|
|
130
|
+
*/
|
|
131
|
+
async function getMilestoneIssues(projectId, milestoneId, options = {}) {
|
|
132
|
+
projectId = decodeURIComponent(projectId);
|
|
133
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
134
|
+
appendFilterParams(url.searchParams, options);
|
|
135
|
+
const response = await fetch(url.toString(), {
|
|
136
|
+
...getFetchConfig(),
|
|
137
|
+
});
|
|
138
|
+
await handleGitLabError(response);
|
|
139
|
+
const data = await response.json();
|
|
140
|
+
return z.array(GitLabIssueSchema).parse(data);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get all merge requests assigned to a single milestone
|
|
144
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
145
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
146
|
+
* @returns {Promise<GitLabMergeRequest[]>} List of merge requests
|
|
147
|
+
*/
|
|
148
|
+
async function getMilestoneMergeRequests(projectId, milestoneId, options = {}) {
|
|
149
|
+
projectId = decodeURIComponent(projectId);
|
|
150
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
151
|
+
appendFilterParams(url.searchParams, options);
|
|
152
|
+
const response = await fetch(url.toString(), {
|
|
153
|
+
...getFetchConfig(),
|
|
154
|
+
});
|
|
155
|
+
await handleGitLabError(response);
|
|
156
|
+
const data = await response.json();
|
|
157
|
+
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Promote a project milestone to a group milestone
|
|
161
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
162
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
163
|
+
* @returns {Promise<GitLabGroupMilestones>} Promoted milestone
|
|
164
|
+
*/
|
|
165
|
+
async function promoteProjectMilestone(projectId, milestoneId) {
|
|
166
|
+
projectId = decodeURIComponent(projectId);
|
|
167
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/promote`);
|
|
168
|
+
const response = await fetch(url.toString(), {
|
|
169
|
+
...getFetchConfig(),
|
|
170
|
+
method: "POST",
|
|
171
|
+
});
|
|
172
|
+
await handleGitLabError(response);
|
|
173
|
+
const data = await response.json();
|
|
174
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get all burndown chart events for a single milestone
|
|
178
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
179
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
180
|
+
* @returns {Promise<any[]>} Burndown chart events
|
|
181
|
+
*/
|
|
182
|
+
async function getMilestoneBurndownEvents(projectId, milestoneId, options = {}) {
|
|
183
|
+
projectId = decodeURIComponent(projectId);
|
|
184
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
185
|
+
appendFilterParams(url.searchParams, options);
|
|
186
|
+
const response = await fetch(url.toString(), {
|
|
187
|
+
...getFetchConfig(),
|
|
188
|
+
});
|
|
189
|
+
await handleGitLabError(response);
|
|
190
|
+
const data = await response.json();
|
|
191
|
+
return data;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List milestones in a GitLab group
|
|
195
|
+
*/
|
|
196
|
+
async function listGroupMilestones(groupId, options) {
|
|
197
|
+
groupId = decodeURIComponent(groupId);
|
|
198
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
199
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
200
|
+
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
201
|
+
const normalized = dropBlankArrayEntries(value);
|
|
202
|
+
if (isBlankFilterValue(normalized)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (key === "iids" && Array.isArray(normalized)) {
|
|
206
|
+
normalized.forEach(iid => {
|
|
207
|
+
url.searchParams.append("iids[]", String(iid));
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
url.searchParams.append(key, String(normalized));
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const response = await fetch(url.toString(), {
|
|
215
|
+
...getFetchConfig(),
|
|
216
|
+
});
|
|
217
|
+
await handleGitLabError(response);
|
|
218
|
+
const data = await response.json();
|
|
219
|
+
return z.array(GitLabGroupMilestonesSchema).parse(data);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get a single milestone in a GitLab group
|
|
223
|
+
*/
|
|
224
|
+
async function getGroupMilestone(groupId, milestoneId) {
|
|
225
|
+
groupId = decodeURIComponent(groupId);
|
|
226
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
227
|
+
const response = await fetch(url.toString(), {
|
|
228
|
+
...getFetchConfig(),
|
|
229
|
+
});
|
|
230
|
+
await handleGitLabError(response);
|
|
231
|
+
const data = await response.json();
|
|
232
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create a new milestone in a GitLab group
|
|
236
|
+
*/
|
|
237
|
+
async function createGroupMilestone(groupId, options) {
|
|
238
|
+
groupId = decodeURIComponent(groupId);
|
|
239
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
240
|
+
const response = await fetch(url.toString(), {
|
|
241
|
+
...getFetchConfig(),
|
|
242
|
+
method: "POST",
|
|
243
|
+
body: JSON.stringify(options),
|
|
244
|
+
});
|
|
245
|
+
await handleGitLabError(response);
|
|
246
|
+
const data = await response.json();
|
|
247
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Edit an existing milestone in a GitLab group
|
|
251
|
+
*/
|
|
252
|
+
async function editGroupMilestone(groupId, milestoneId, options) {
|
|
253
|
+
groupId = decodeURIComponent(groupId);
|
|
254
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
255
|
+
const response = await fetch(url.toString(), {
|
|
256
|
+
...getFetchConfig(),
|
|
257
|
+
method: "PUT",
|
|
258
|
+
body: JSON.stringify(options),
|
|
259
|
+
});
|
|
260
|
+
await handleGitLabError(response);
|
|
261
|
+
const data = await response.json();
|
|
262
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Delete a milestone from a GitLab group
|
|
266
|
+
*/
|
|
267
|
+
async function deleteGroupMilestone(groupId, milestoneId) {
|
|
268
|
+
groupId = decodeURIComponent(groupId);
|
|
269
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
270
|
+
const response = await fetch(url.toString(), {
|
|
271
|
+
...getFetchConfig(),
|
|
272
|
+
method: "DELETE",
|
|
273
|
+
});
|
|
274
|
+
await handleGitLabError(response);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get all issues assigned to a single group milestone
|
|
278
|
+
*/
|
|
279
|
+
async function getGroupMilestoneIssues(groupId, milestoneId, options = {}) {
|
|
280
|
+
groupId = decodeURIComponent(groupId);
|
|
281
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
282
|
+
appendFilterParams(url.searchParams, options);
|
|
283
|
+
const response = await fetch(url.toString(), {
|
|
284
|
+
...getFetchConfig(),
|
|
285
|
+
});
|
|
286
|
+
await handleGitLabError(response);
|
|
287
|
+
const data = await response.json();
|
|
288
|
+
return z.array(GitLabIssueSchema).parse(data);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get all merge requests assigned to a single group milestone
|
|
292
|
+
*/
|
|
293
|
+
async function getGroupMilestoneMergeRequests(groupId, milestoneId, options = {}) {
|
|
294
|
+
groupId = decodeURIComponent(groupId);
|
|
295
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
296
|
+
appendFilterParams(url.searchParams, options);
|
|
297
|
+
const response = await fetch(url.toString(), {
|
|
298
|
+
...getFetchConfig(),
|
|
299
|
+
});
|
|
300
|
+
await handleGitLabError(response);
|
|
301
|
+
const data = await response.json();
|
|
302
|
+
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Get burndown chart events for a group milestone
|
|
306
|
+
*/
|
|
307
|
+
async function getGroupMilestoneBurndownEvents(groupId, milestoneId, options = {}) {
|
|
308
|
+
groupId = decodeURIComponent(groupId);
|
|
309
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
310
|
+
appendFilterParams(url.searchParams, options);
|
|
311
|
+
const response = await fetch(url.toString(), {
|
|
312
|
+
...getFetchConfig(),
|
|
313
|
+
});
|
|
314
|
+
await handleGitLabError(response);
|
|
315
|
+
const data = await response.json();
|
|
316
|
+
return data;
|
|
317
|
+
}
|
|
318
|
+
export async function handleMilestoneToolCall(params) {
|
|
319
|
+
switch (params.name) {
|
|
320
|
+
case "list_milestones": {
|
|
321
|
+
const { project_id, ...options } = ListProjectMilestonesSchema.parse(params.arguments);
|
|
322
|
+
const milestones = await listProjectMilestones(project_id, options);
|
|
323
|
+
return {
|
|
324
|
+
content: [
|
|
325
|
+
{
|
|
326
|
+
type: "text",
|
|
327
|
+
text: JSON.stringify(milestones),
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
case "get_milestone": {
|
|
333
|
+
const { project_id, milestone_id } = GetProjectMilestoneSchema.parse(params.arguments);
|
|
334
|
+
const milestone = await getProjectMilestone(project_id, milestone_id);
|
|
335
|
+
return {
|
|
336
|
+
content: [
|
|
337
|
+
{
|
|
338
|
+
type: "text",
|
|
339
|
+
text: JSON.stringify(milestone),
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
case "create_milestone": {
|
|
345
|
+
const { project_id, ...options } = CreateProjectMilestoneSchema.parse(params.arguments);
|
|
346
|
+
const milestone = await createProjectMilestone(project_id, options);
|
|
347
|
+
return {
|
|
348
|
+
content: [
|
|
349
|
+
{
|
|
350
|
+
type: "text",
|
|
351
|
+
text: JSON.stringify(milestone),
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
case "edit_milestone": {
|
|
357
|
+
const { project_id, milestone_id, ...options } = EditProjectMilestoneSchema.parse(params.arguments);
|
|
358
|
+
const milestone = await editProjectMilestone(project_id, milestone_id, options);
|
|
359
|
+
return {
|
|
360
|
+
content: [
|
|
361
|
+
{
|
|
362
|
+
type: "text",
|
|
363
|
+
text: JSON.stringify(milestone),
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
case "delete_milestone": {
|
|
369
|
+
const { project_id, milestone_id } = DeleteProjectMilestoneSchema.parse(params.arguments);
|
|
370
|
+
await deleteProjectMilestone(project_id, milestone_id);
|
|
371
|
+
return {
|
|
372
|
+
content: [
|
|
373
|
+
{
|
|
374
|
+
type: "text",
|
|
375
|
+
text: JSON.stringify({
|
|
376
|
+
status: "success",
|
|
377
|
+
message: "Milestone deleted successfully",
|
|
378
|
+
}),
|
|
379
|
+
},
|
|
380
|
+
],
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
case "get_milestone_issue": {
|
|
384
|
+
const { project_id, milestone_id, ...options } = GetMilestoneIssuesSchema.parse(params.arguments);
|
|
385
|
+
const issues = await getMilestoneIssues(project_id, milestone_id, options);
|
|
386
|
+
return {
|
|
387
|
+
content: [
|
|
388
|
+
{
|
|
389
|
+
type: "text",
|
|
390
|
+
text: JSON.stringify(issues),
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
case "get_milestone_merge_requests": {
|
|
396
|
+
const { project_id, milestone_id, ...options } = GetMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
397
|
+
const mergeRequests = await getMilestoneMergeRequests(project_id, milestone_id, options);
|
|
398
|
+
return {
|
|
399
|
+
content: [
|
|
400
|
+
{
|
|
401
|
+
type: "text",
|
|
402
|
+
text: JSON.stringify(mergeRequests),
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
case "promote_milestone": {
|
|
408
|
+
const { project_id, milestone_id } = PromoteProjectMilestoneSchema.parse(params.arguments);
|
|
409
|
+
const milestone = await promoteProjectMilestone(project_id, milestone_id);
|
|
410
|
+
return {
|
|
411
|
+
content: [
|
|
412
|
+
{
|
|
413
|
+
type: "text",
|
|
414
|
+
text: JSON.stringify(milestone),
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
case "get_milestone_burndown_events": {
|
|
420
|
+
const { project_id, milestone_id, ...options } = GetMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
421
|
+
const events = await getMilestoneBurndownEvents(project_id, milestone_id, options);
|
|
422
|
+
return {
|
|
423
|
+
content: [
|
|
424
|
+
{
|
|
425
|
+
type: "text",
|
|
426
|
+
text: JSON.stringify(events),
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
case "list_group_milestones": {
|
|
432
|
+
rejectIfStrictProjectScope("list_group_milestones");
|
|
433
|
+
const { group_id, ...options } = ListGroupMilestonesSchema.parse(params.arguments);
|
|
434
|
+
const milestones = await listGroupMilestones(group_id, options);
|
|
435
|
+
return {
|
|
436
|
+
content: [
|
|
437
|
+
{
|
|
438
|
+
type: "text",
|
|
439
|
+
text: JSON.stringify(milestones),
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
case "get_group_milestone": {
|
|
445
|
+
rejectIfStrictProjectScope("get_group_milestone");
|
|
446
|
+
const { group_id, milestone_id } = GetGroupMilestoneSchema.parse(params.arguments);
|
|
447
|
+
const milestone = await getGroupMilestone(group_id, milestone_id);
|
|
448
|
+
return {
|
|
449
|
+
content: [
|
|
450
|
+
{
|
|
451
|
+
type: "text",
|
|
452
|
+
text: JSON.stringify(milestone),
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
case "create_group_milestone": {
|
|
458
|
+
rejectIfStrictProjectScope("create_group_milestone");
|
|
459
|
+
const { group_id, ...options } = CreateGroupMilestoneSchema.parse(params.arguments);
|
|
460
|
+
const milestone = await createGroupMilestone(group_id, options);
|
|
461
|
+
return {
|
|
462
|
+
content: [
|
|
463
|
+
{
|
|
464
|
+
type: "text",
|
|
465
|
+
text: JSON.stringify(milestone),
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
case "edit_group_milestone": {
|
|
471
|
+
rejectIfStrictProjectScope("edit_group_milestone");
|
|
472
|
+
const { group_id, milestone_id, ...options } = EditGroupMilestoneSchema.parse(params.arguments);
|
|
473
|
+
const milestone = await editGroupMilestone(group_id, milestone_id, options);
|
|
474
|
+
return {
|
|
475
|
+
content: [
|
|
476
|
+
{
|
|
477
|
+
type: "text",
|
|
478
|
+
text: JSON.stringify(milestone),
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
case "delete_group_milestone": {
|
|
484
|
+
rejectIfStrictProjectScope("delete_group_milestone");
|
|
485
|
+
const { group_id, milestone_id } = DeleteGroupMilestoneSchema.parse(params.arguments);
|
|
486
|
+
await deleteGroupMilestone(group_id, milestone_id);
|
|
487
|
+
return {
|
|
488
|
+
content: [
|
|
489
|
+
{
|
|
490
|
+
type: "text",
|
|
491
|
+
text: JSON.stringify({
|
|
492
|
+
status: "success",
|
|
493
|
+
message: "Group milestone deleted successfully",
|
|
494
|
+
}),
|
|
495
|
+
},
|
|
496
|
+
],
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
case "get_group_milestone_issue": {
|
|
500
|
+
rejectIfStrictProjectScope("get_group_milestone_issue");
|
|
501
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneIssuesSchema.parse(params.arguments);
|
|
502
|
+
const issues = await getGroupMilestoneIssues(group_id, milestone_id, options);
|
|
503
|
+
return {
|
|
504
|
+
content: [
|
|
505
|
+
{
|
|
506
|
+
type: "text",
|
|
507
|
+
text: JSON.stringify(issues),
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
case "get_group_milestone_merge_requests": {
|
|
513
|
+
rejectIfStrictProjectScope("get_group_milestone_merge_requests");
|
|
514
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
515
|
+
const mergeRequests = await getGroupMilestoneMergeRequests(group_id, milestone_id, options);
|
|
516
|
+
return {
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
text: JSON.stringify(mergeRequests),
|
|
521
|
+
},
|
|
522
|
+
],
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case "get_group_milestone_burndown_events": {
|
|
526
|
+
rejectIfStrictProjectScope("get_group_milestone_burndown_events");
|
|
527
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
528
|
+
const events = await getGroupMilestoneBurndownEvents(group_id, milestone_id, options);
|
|
529
|
+
return {
|
|
530
|
+
content: [
|
|
531
|
+
{
|
|
532
|
+
type: "text",
|
|
533
|
+
text: JSON.stringify(events),
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
default:
|
|
539
|
+
throw new Error(`Unknown tool: ${params.name}`);
|
|
540
|
+
}
|
|
541
|
+
}
|
package/package.json
CHANGED