@structured-world/gitlab-mcp 4.5.0 → 5.2.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/README.md +18 -0
- package/dist/config.js +23 -23
- package/dist/config.js.map +1 -1
- package/dist/entities/core/index.d.ts +5 -5
- package/dist/entities/core/index.js +1 -1
- package/dist/entities/core/registry.d.ts +1 -1
- package/dist/entities/core/registry.js +149 -149
- package/dist/entities/core/registry.js.map +1 -1
- package/dist/entities/core/schema-readonly.d.ts +1 -1
- package/dist/entities/core/schema-readonly.js +132 -132
- package/dist/entities/core/schema-readonly.js.map +1 -1
- package/dist/entities/core/schema.d.ts +1 -1
- package/dist/entities/core/schema.js +59 -59
- package/dist/entities/files/index.d.ts +5 -5
- package/dist/entities/files/index.js +1 -1
- package/dist/entities/files/registry.d.ts +1 -1
- package/dist/entities/files/registry.js +32 -32
- package/dist/entities/files/registry.js.map +1 -1
- package/dist/entities/files/schema-readonly.d.ts +1 -1
- package/dist/entities/files/schema-readonly.js +10 -10
- package/dist/entities/files/schema.d.ts +1 -1
- package/dist/entities/files/schema.js +19 -19
- package/dist/entities/index.d.ts +10 -10
- package/dist/entities/labels/index.d.ts +5 -5
- package/dist/entities/labels/index.js +1 -1
- package/dist/entities/labels/registry.d.ts +1 -1
- package/dist/entities/labels/registry.js +31 -31
- package/dist/entities/labels/registry.js.map +1 -1
- package/dist/entities/labels/schema-readonly.d.ts +1 -1
- package/dist/entities/labels/schema-readonly.js +7 -7
- package/dist/entities/labels/schema.d.ts +1 -1
- package/dist/entities/labels/schema.js +11 -11
- package/dist/entities/milestones/index.d.ts +5 -5
- package/dist/entities/milestones/index.js +1 -1
- package/dist/entities/milestones/registry.d.ts +1 -1
- package/dist/entities/milestones/registry.js +49 -49
- package/dist/entities/milestones/registry.js.map +1 -1
- package/dist/entities/milestones/schema-readonly.d.ts +2 -2
- package/dist/entities/milestones/schema-readonly.js +11 -11
- package/dist/entities/milestones/schema.d.ts +1 -1
- package/dist/entities/milestones/schema.js +18 -18
- package/dist/entities/milestones/schema.js.map +1 -1
- package/dist/entities/mrs/index.d.ts +5 -5
- package/dist/entities/mrs/index.js +1 -1
- package/dist/entities/mrs/registry.d.ts +1 -1
- package/dist/entities/mrs/registry.js +118 -118
- package/dist/entities/mrs/registry.js.map +1 -1
- package/dist/entities/mrs/schema-readonly.d.ts +1 -1
- package/dist/entities/mrs/schema-readonly.js +47 -47
- package/dist/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/entities/mrs/schema.d.ts +1 -1
- package/dist/entities/mrs/schema.js +86 -86
- package/dist/entities/mrs/schema.js.map +1 -1
- package/dist/entities/pipelines/index.d.ts +5 -5
- package/dist/entities/pipelines/index.js +1 -1
- package/dist/entities/pipelines/registry.d.ts +1 -1
- package/dist/entities/pipelines/registry.js +58 -58
- package/dist/entities/pipelines/registry.js.map +1 -1
- package/dist/entities/pipelines/schema-readonly.d.ts +1 -1
- package/dist/entities/pipelines/schema-readonly.js +65 -65
- package/dist/entities/pipelines/schema.d.ts +1 -1
- package/dist/entities/pipelines/schema.js +15 -15
- package/dist/entities/shared.d.ts +1 -1
- package/dist/entities/shared.js +7 -7
- package/dist/entities/utils.d.ts +1 -1
- package/dist/entities/utils.js +5 -5
- package/dist/entities/utils.js.map +1 -1
- package/dist/entities/variables/index.d.ts +5 -5
- package/dist/entities/variables/index.js +1 -1
- package/dist/entities/variables/registry.d.ts +1 -1
- package/dist/entities/variables/registry.js +29 -29
- package/dist/entities/variables/registry.js.map +1 -1
- package/dist/entities/variables/schema-readonly.d.ts +1 -1
- package/dist/entities/variables/schema-readonly.js +4 -4
- package/dist/entities/variables/schema.d.ts +1 -1
- package/dist/entities/variables/schema.js +32 -32
- package/dist/entities/variables/schema.js.map +1 -1
- package/dist/entities/wiki/index.d.ts +5 -5
- package/dist/entities/wiki/index.js +1 -1
- package/dist/entities/wiki/registry.d.ts +1 -1
- package/dist/entities/wiki/registry.js +26 -26
- package/dist/entities/wiki/registry.js.map +1 -1
- package/dist/entities/wiki/schema-readonly.d.ts +1 -1
- package/dist/entities/wiki/schema-readonly.js +4 -4
- package/dist/entities/wiki/schema.d.ts +1 -1
- package/dist/entities/wiki/schema.js +11 -11
- package/dist/entities/workitems/index.d.ts +5 -5
- package/dist/entities/workitems/index.js +1 -1
- package/dist/entities/workitems/registry.d.ts +1 -1
- package/dist/entities/workitems/registry.js +55 -55
- package/dist/entities/workitems/registry.js.map +1 -1
- package/dist/entities/workitems/schema-readonly.d.ts +1 -1
- package/dist/entities/workitems/schema-readonly.js +25 -25
- package/dist/entities/workitems/schema-readonly.js.map +1 -1
- package/dist/entities/workitems/schema.d.ts +1 -1
- package/dist/entities/workitems/schema.js +11 -11
- package/dist/graphql/DynamicWorkItemsQuery.d.ts +2 -2
- package/dist/graphql/DynamicWorkItemsQuery.js +47 -47
- package/dist/graphql/DynamicWorkItemsQuery.js.map +1 -1
- package/dist/graphql/client.d.ts +1 -1
- package/dist/graphql/client.js +4 -4
- package/dist/graphql/client.js.map +1 -1
- package/dist/graphql/index.d.ts +2 -2
- package/dist/graphql/workItems.d.ts +33 -33
- package/dist/graphql/workItems.js +29 -29
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +20 -20
- package/dist/handlers.js.map +1 -1
- package/dist/http-client.js +3 -3
- package/dist/logger.js +4 -4
- package/dist/registry-manager.d.ts +1 -1
- package/dist/registry-manager.js +27 -27
- package/dist/server.d.ts +1 -1
- package/dist/server.js +46 -46
- package/dist/services/ConnectionManager.d.ts +4 -4
- package/dist/services/ConnectionManager.js +13 -13
- package/dist/services/GitLabVersionDetector.d.ts +2 -2
- package/dist/services/GitLabVersionDetector.js +41 -41
- package/dist/services/GitLabVersionDetector.js.map +1 -1
- package/dist/services/SchemaIntrospector.d.ts +1 -1
- package/dist/services/SchemaIntrospector.js +42 -42
- package/dist/services/SchemaIntrospector.js.map +1 -1
- package/dist/services/ToolAvailability.d.ts +2 -2
- package/dist/services/ToolAvailability.js +279 -279
- package/dist/services/ToolAvailability.js.map +1 -1
- package/dist/services/WidgetAvailability.d.ts +3 -3
- package/dist/services/WidgetAvailability.js +32 -32
- package/dist/structured-world-gitlab-mcp-5.2.0.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types.js +4 -4
- package/dist/utils/fetch.d.ts +4 -4
- package/dist/utils/fetch.js +15 -15
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/idConversion.js +33 -33
- package/dist/utils/idConversion.js.map +1 -1
- package/dist/utils/namespace.d.ts +2 -2
- package/dist/utils/namespace.js +13 -13
- package/dist/utils/smart-user-search.d.ts +1 -1
- package/dist/utils/smart-user-search.js +10 -10
- package/package.json +1 -1
- package/dist/structured-world-gitlab-mcp-4.5.0.tgz +0 -0
|
@@ -11,17 +11,17 @@ const fetch_1 = require("../../utils/fetch");
|
|
|
11
11
|
const idConversion_1 = require("../../utils/idConversion");
|
|
12
12
|
exports.mrsToolRegistry = new Map([
|
|
13
13
|
[
|
|
14
|
-
|
|
14
|
+
"get_branch_diffs",
|
|
15
15
|
{
|
|
16
|
-
name:
|
|
17
|
-
description:
|
|
16
|
+
name: "get_branch_diffs",
|
|
17
|
+
description: "COMPARE: Get diffs between two branches or commits in a GitLab project. Use when: Reviewing changes before merging, Analyzing code differences, Generating change reports. Supports both direct comparison and merge-base comparison methods.",
|
|
18
18
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetBranchDiffsSchema),
|
|
19
19
|
handler: async (args) => {
|
|
20
20
|
const options = schema_readonly_1.GetBranchDiffsSchema.parse(args);
|
|
21
21
|
const { project_id, from, to, straight } = options;
|
|
22
22
|
const queryParams = new URLSearchParams();
|
|
23
23
|
if (straight !== undefined) {
|
|
24
|
-
queryParams.set(
|
|
24
|
+
queryParams.set("straight", String(straight));
|
|
25
25
|
}
|
|
26
26
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(project_id)}/repository/compare?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}&${queryParams}`;
|
|
27
27
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
@@ -38,10 +38,10 @@ exports.mrsToolRegistry = new Map([
|
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
40
|
[
|
|
41
|
-
|
|
41
|
+
"get_merge_request",
|
|
42
42
|
{
|
|
43
|
-
name:
|
|
44
|
-
description:
|
|
43
|
+
name: "get_merge_request",
|
|
44
|
+
description: "READ: Get comprehensive details of a merge request including status, discussions, and approvals. Use when: Reviewing MR details, Checking merge status, Gathering information for automation. Accepts either MR IID or source branch name for flexibility.",
|
|
45
45
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetMergeRequestSchema),
|
|
46
46
|
handler: async (args) => {
|
|
47
47
|
const options = schema_readonly_1.GetMergeRequestSchema.parse(args);
|
|
@@ -54,7 +54,7 @@ exports.mrsToolRegistry = new Map([
|
|
|
54
54
|
apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(project_id)}/merge_requests?source_branch=${encodeURIComponent(branch_name)}`;
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error("Either merge_request_iid or branch_name must be provided");
|
|
58
58
|
}
|
|
59
59
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
60
60
|
headers: {
|
|
@@ -70,7 +70,7 @@ exports.mrsToolRegistry = new Map([
|
|
|
70
70
|
return result[0];
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
-
throw new Error(
|
|
73
|
+
throw new Error("No merge request found for branch");
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
return (0, idConversion_1.cleanGidsFromObject)(result);
|
|
@@ -78,16 +78,16 @@ exports.mrsToolRegistry = new Map([
|
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
80
|
[
|
|
81
|
-
|
|
81
|
+
"list_merge_requests",
|
|
82
82
|
{
|
|
83
|
-
name:
|
|
84
|
-
description:
|
|
83
|
+
name: "list_merge_requests",
|
|
84
|
+
description: "BROWSE: List merge requests in a GitLab project with extensive filtering capabilities. Use when: Finding MRs by state/author/assignee, Complex queries for MR management, Reporting on merge requests. Can search globally or within specific projects.",
|
|
85
85
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListMergeRequestsSchema),
|
|
86
86
|
handler: async (args) => {
|
|
87
87
|
const options = schema_readonly_1.ListMergeRequestsSchema.parse(args);
|
|
88
88
|
const queryParams = new URLSearchParams();
|
|
89
89
|
Object.entries(options).forEach(([key, value]) => {
|
|
90
|
-
if (value !== undefined && value !== null && key !==
|
|
90
|
+
if (value !== undefined && value !== null && key !== "project_id") {
|
|
91
91
|
queryParams.set(key, String(value));
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -108,20 +108,20 @@ exports.mrsToolRegistry = new Map([
|
|
|
108
108
|
},
|
|
109
109
|
],
|
|
110
110
|
[
|
|
111
|
-
|
|
111
|
+
"get_merge_request_diffs",
|
|
112
112
|
{
|
|
113
|
-
name:
|
|
114
|
-
description:
|
|
113
|
+
name: "get_merge_request_diffs",
|
|
114
|
+
description: "READ: Get all file changes and diffs included in a merge request. Use when: Reviewing code changes, Analyzing modifications, Automating code review processes. Shows actual file differences that would be applied if merged.",
|
|
115
115
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetMergeRequestDiffsSchema),
|
|
116
116
|
handler: async (args) => {
|
|
117
117
|
const options = schema_readonly_1.GetMergeRequestDiffsSchema.parse(args);
|
|
118
118
|
const { project_id, merge_request_iid, page, per_page } = options;
|
|
119
119
|
const queryParams = new URLSearchParams();
|
|
120
120
|
if (page !== undefined) {
|
|
121
|
-
queryParams.set(
|
|
121
|
+
queryParams.set("page", String(page));
|
|
122
122
|
}
|
|
123
123
|
if (per_page !== undefined) {
|
|
124
|
-
queryParams.set(
|
|
124
|
+
queryParams.set("per_page", String(per_page));
|
|
125
125
|
}
|
|
126
126
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(project_id)}/merge_requests/${merge_request_iid}/changes?${queryParams}`;
|
|
127
127
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
@@ -138,20 +138,20 @@ exports.mrsToolRegistry = new Map([
|
|
|
138
138
|
},
|
|
139
139
|
],
|
|
140
140
|
[
|
|
141
|
-
|
|
141
|
+
"list_merge_request_diffs",
|
|
142
142
|
{
|
|
143
|
-
name:
|
|
144
|
-
description:
|
|
143
|
+
name: "list_merge_request_diffs",
|
|
144
|
+
description: "BROWSE: List all diffs in a merge request with pagination for large changesets. Use when: Dealing with MRs containing many changes, Managing memory usage, Processing large diffs efficiently. Provides paginated access to file modifications.",
|
|
145
145
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListMergeRequestDiffsSchema),
|
|
146
146
|
handler: async (args) => {
|
|
147
147
|
const options = schema_readonly_1.ListMergeRequestDiffsSchema.parse(args);
|
|
148
148
|
const { project_id, merge_request_iid, page, per_page } = options;
|
|
149
149
|
const queryParams = new URLSearchParams();
|
|
150
150
|
if (page !== undefined) {
|
|
151
|
-
queryParams.set(
|
|
151
|
+
queryParams.set("page", String(page));
|
|
152
152
|
}
|
|
153
153
|
if (per_page !== undefined) {
|
|
154
|
-
queryParams.set(
|
|
154
|
+
queryParams.set("per_page", String(per_page));
|
|
155
155
|
}
|
|
156
156
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(project_id)}/merge_requests/${merge_request_iid}/diffs?${queryParams}`;
|
|
157
157
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
@@ -168,17 +168,17 @@ exports.mrsToolRegistry = new Map([
|
|
|
168
168
|
},
|
|
169
169
|
],
|
|
170
170
|
[
|
|
171
|
-
|
|
171
|
+
"mr_discussions",
|
|
172
172
|
{
|
|
173
|
-
name:
|
|
174
|
-
description:
|
|
173
|
+
name: "mr_discussions",
|
|
174
|
+
description: "DISCUSS: List all discussion threads and comments on a merge request. Use when: Tracking code review feedback, Managing conversations, Extracting review insights. Includes both resolved and unresolved discussions with full context.",
|
|
175
175
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListMergeRequestDiscussionsSchema),
|
|
176
176
|
handler: async (args) => {
|
|
177
177
|
const options = schema_readonly_1.ListMergeRequestDiscussionsSchema.parse(args);
|
|
178
178
|
const { project_id, merge_request_iid } = options;
|
|
179
179
|
const queryParams = new URLSearchParams();
|
|
180
180
|
Object.entries(options).forEach(([key, value]) => {
|
|
181
|
-
if (value !== undefined && key !==
|
|
181
|
+
if (value !== undefined && key !== "project_id" && key !== "merge_request_iid") {
|
|
182
182
|
queryParams.set(key, String(value));
|
|
183
183
|
}
|
|
184
184
|
});
|
|
@@ -197,10 +197,10 @@ exports.mrsToolRegistry = new Map([
|
|
|
197
197
|
},
|
|
198
198
|
],
|
|
199
199
|
[
|
|
200
|
-
|
|
200
|
+
"get_draft_note",
|
|
201
201
|
{
|
|
202
|
-
name:
|
|
203
|
-
description:
|
|
202
|
+
name: "get_draft_note",
|
|
203
|
+
description: "DRAFT: Retrieve a specific draft note (unpublished comment) from a merge request. Use when: Reviewing pending feedback before publishing, Managing draft review comments. Draft notes are only visible to their author until published.",
|
|
204
204
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetDraftNoteSchema),
|
|
205
205
|
handler: async (args) => {
|
|
206
206
|
const options = schema_readonly_1.GetDraftNoteSchema.parse(args);
|
|
@@ -220,17 +220,17 @@ exports.mrsToolRegistry = new Map([
|
|
|
220
220
|
},
|
|
221
221
|
],
|
|
222
222
|
[
|
|
223
|
-
|
|
223
|
+
"list_draft_notes",
|
|
224
224
|
{
|
|
225
|
-
name:
|
|
226
|
-
description:
|
|
225
|
+
name: "list_draft_notes",
|
|
226
|
+
description: "DRAFT: List all draft notes (unpublished comments) for a merge request. Use when: Reviewing all pending feedback before publishing, Managing batch review comments. Draft notes allow reviewers to prepare comprehensive feedback before sharing.",
|
|
227
227
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListDraftNotesSchema),
|
|
228
228
|
handler: async (args) => {
|
|
229
229
|
const options = schema_readonly_1.ListDraftNotesSchema.parse(args);
|
|
230
230
|
const { project_id, merge_request_iid } = options;
|
|
231
231
|
const queryParams = new URLSearchParams();
|
|
232
232
|
Object.entries(options).forEach(([key, value]) => {
|
|
233
|
-
if (value !== undefined && key !==
|
|
233
|
+
if (value !== undefined && key !== "project_id" && key !== "merge_request_iid") {
|
|
234
234
|
queryParams.set(key, String(value));
|
|
235
235
|
}
|
|
236
236
|
});
|
|
@@ -249,10 +249,10 @@ exports.mrsToolRegistry = new Map([
|
|
|
249
249
|
},
|
|
250
250
|
],
|
|
251
251
|
[
|
|
252
|
-
|
|
252
|
+
"create_merge_request",
|
|
253
253
|
{
|
|
254
|
-
name:
|
|
255
|
-
description:
|
|
254
|
+
name: "create_merge_request",
|
|
255
|
+
description: "CREATE: Create a new merge request to propose code changes for review and merging. Use when: Initiating code review process, Proposing features, Submitting fixes. For labels: Use list_labels FIRST to discover existing project taxonomy. Requires source and target branches, supports setting assignees, reviewers, and labels.",
|
|
256
256
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateMergeRequestSchema),
|
|
257
257
|
handler: async (args) => {
|
|
258
258
|
const options = schema_1.CreateMergeRequestSchema.parse(args);
|
|
@@ -260,7 +260,7 @@ exports.mrsToolRegistry = new Map([
|
|
|
260
260
|
Object.entries(options).forEach(([key, value]) => {
|
|
261
261
|
if (value !== undefined && value !== null) {
|
|
262
262
|
if (Array.isArray(value)) {
|
|
263
|
-
body.set(key, value.join(
|
|
263
|
+
body.set(key, value.join(","));
|
|
264
264
|
}
|
|
265
265
|
else {
|
|
266
266
|
body.set(key, String(value));
|
|
@@ -269,10 +269,10 @@ exports.mrsToolRegistry = new Map([
|
|
|
269
269
|
});
|
|
270
270
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests`;
|
|
271
271
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
272
|
-
method:
|
|
272
|
+
method: "POST",
|
|
273
273
|
headers: {
|
|
274
274
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
275
|
-
|
|
275
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
276
276
|
},
|
|
277
277
|
body: body.toString(),
|
|
278
278
|
});
|
|
@@ -285,25 +285,25 @@ exports.mrsToolRegistry = new Map([
|
|
|
285
285
|
},
|
|
286
286
|
],
|
|
287
287
|
[
|
|
288
|
-
|
|
288
|
+
"merge_merge_request",
|
|
289
289
|
{
|
|
290
|
-
name:
|
|
291
|
-
description:
|
|
290
|
+
name: "merge_merge_request",
|
|
291
|
+
description: "MERGE: Merge an approved merge request into the target branch. Use when: Completing the code review process, Integrating changes. Supports various merge methods (merge commit, squash, rebase) and can delete source branch after merging.",
|
|
292
292
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.MergeMergeRequestSchema),
|
|
293
293
|
handler: async (args) => {
|
|
294
294
|
const options = schema_1.MergeMergeRequestSchema.parse(args);
|
|
295
295
|
const body = new URLSearchParams();
|
|
296
296
|
Object.entries(options).forEach(([key, value]) => {
|
|
297
|
-
if (value !== undefined && key !==
|
|
297
|
+
if (value !== undefined && key !== "project_id" && key !== "merge_request_iid") {
|
|
298
298
|
body.set(key, String(value));
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
301
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/merge`;
|
|
302
302
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
303
|
-
method:
|
|
303
|
+
method: "PUT",
|
|
304
304
|
headers: {
|
|
305
305
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
306
|
-
|
|
306
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
307
307
|
},
|
|
308
308
|
body: body.toString(),
|
|
309
309
|
});
|
|
@@ -316,29 +316,29 @@ exports.mrsToolRegistry = new Map([
|
|
|
316
316
|
},
|
|
317
317
|
],
|
|
318
318
|
[
|
|
319
|
-
|
|
319
|
+
"create_note",
|
|
320
320
|
{
|
|
321
|
-
name:
|
|
322
|
-
description:
|
|
321
|
+
name: "create_note",
|
|
322
|
+
description: "COMMENT: Add a comment to an issue or merge request for discussion or feedback. Use when: Providing code review comments, Asking questions, Documenting decisions. Supports markdown formatting and can trigger notifications to participants.",
|
|
323
323
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateNoteSchema),
|
|
324
324
|
handler: async (args) => {
|
|
325
325
|
const options = schema_1.CreateNoteSchema.parse(args);
|
|
326
326
|
const body = new URLSearchParams();
|
|
327
|
-
body.set(
|
|
327
|
+
body.set("body", options.body);
|
|
328
328
|
if (options.created_at) {
|
|
329
|
-
body.set(
|
|
329
|
+
body.set("created_at", options.created_at);
|
|
330
330
|
}
|
|
331
331
|
if (options.confidential !== undefined) {
|
|
332
|
-
body.set(
|
|
332
|
+
body.set("confidential", String(options.confidential));
|
|
333
333
|
}
|
|
334
|
-
const resourceType = options.noteable_type ===
|
|
334
|
+
const resourceType = options.noteable_type === "merge_request" ? "merge_requests" : "issues";
|
|
335
335
|
const resourceId = options.noteable_id;
|
|
336
336
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/${resourceType}/${resourceId}/notes`;
|
|
337
337
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
338
|
-
method:
|
|
338
|
+
method: "POST",
|
|
339
339
|
headers: {
|
|
340
340
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
341
|
-
|
|
341
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
342
342
|
},
|
|
343
343
|
body: body.toString(),
|
|
344
344
|
});
|
|
@@ -351,24 +351,24 @@ exports.mrsToolRegistry = new Map([
|
|
|
351
351
|
},
|
|
352
352
|
],
|
|
353
353
|
[
|
|
354
|
-
|
|
354
|
+
"create_draft_note",
|
|
355
355
|
{
|
|
356
|
-
name:
|
|
357
|
-
description:
|
|
356
|
+
name: "create_draft_note",
|
|
357
|
+
description: "DRAFT: Create a draft note (unpublished comment) on a merge request. Use when: Preparing review feedback that can be refined before publishing. Draft notes are ideal for comprehensive reviews where all comments are published together.",
|
|
358
358
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateDraftNoteSchema),
|
|
359
359
|
handler: async (args) => {
|
|
360
360
|
const options = schema_1.CreateDraftNoteSchema.parse(args);
|
|
361
361
|
const body = new URLSearchParams();
|
|
362
|
-
body.set(
|
|
362
|
+
body.set("note", options.note);
|
|
363
363
|
if (options.position) {
|
|
364
|
-
body.set(
|
|
364
|
+
body.set("position", JSON.stringify(options.position));
|
|
365
365
|
}
|
|
366
366
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/draft_notes`;
|
|
367
367
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
368
|
-
method:
|
|
368
|
+
method: "POST",
|
|
369
369
|
headers: {
|
|
370
370
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
371
|
-
|
|
371
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
372
372
|
},
|
|
373
373
|
body: body.toString(),
|
|
374
374
|
});
|
|
@@ -381,16 +381,16 @@ exports.mrsToolRegistry = new Map([
|
|
|
381
381
|
},
|
|
382
382
|
],
|
|
383
383
|
[
|
|
384
|
-
|
|
384
|
+
"publish_draft_note",
|
|
385
385
|
{
|
|
386
|
-
name:
|
|
387
|
-
description:
|
|
386
|
+
name: "publish_draft_note",
|
|
387
|
+
description: "DRAFT: Publish a previously created draft note to make it visible to all participants. Use when: Selectively sharing specific review comments when ready. Once published, the note becomes a regular comment and triggers notifications.",
|
|
388
388
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.PublishDraftNoteSchema),
|
|
389
389
|
handler: async (args) => {
|
|
390
390
|
const options = schema_1.PublishDraftNoteSchema.parse(args);
|
|
391
391
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/draft_notes/${options.draft_note_id}/publish`;
|
|
392
392
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
393
|
-
method:
|
|
393
|
+
method: "PUT",
|
|
394
394
|
headers: {
|
|
395
395
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
396
396
|
},
|
|
@@ -404,16 +404,16 @@ exports.mrsToolRegistry = new Map([
|
|
|
404
404
|
},
|
|
405
405
|
],
|
|
406
406
|
[
|
|
407
|
-
|
|
407
|
+
"bulk_publish_draft_notes",
|
|
408
408
|
{
|
|
409
|
-
name:
|
|
410
|
-
description:
|
|
409
|
+
name: "bulk_publish_draft_notes",
|
|
410
|
+
description: "Publish all pending draft notes for a merge request simultaneously. Use to share comprehensive review feedback in one action. Ideal for thorough code reviews where all comments should be seen together for context.",
|
|
411
411
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.BulkPublishDraftNotesSchema),
|
|
412
412
|
handler: async (args) => {
|
|
413
413
|
const options = schema_1.BulkPublishDraftNotesSchema.parse(args);
|
|
414
414
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/draft_notes/bulk_publish`;
|
|
415
415
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
416
|
-
method:
|
|
416
|
+
method: "POST",
|
|
417
417
|
headers: {
|
|
418
418
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
419
419
|
},
|
|
@@ -427,18 +427,18 @@ exports.mrsToolRegistry = new Map([
|
|
|
427
427
|
},
|
|
428
428
|
],
|
|
429
429
|
[
|
|
430
|
-
|
|
430
|
+
"update_merge_request",
|
|
431
431
|
{
|
|
432
|
-
name:
|
|
433
|
-
description:
|
|
432
|
+
name: "update_merge_request",
|
|
433
|
+
description: "UPDATE: Update properties of an existing merge request such as title, description, or assignees. Use when: Refining MR details, Changing reviewers, Updating labels. For labels: Use list_labels FIRST to discover existing taxonomy before updating. Accepts either MR IID or source branch name for identification.",
|
|
434
434
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateMergeRequestSchema),
|
|
435
435
|
handler: async (args) => {
|
|
436
436
|
const options = schema_1.UpdateMergeRequestSchema.parse(args);
|
|
437
437
|
const body = new URLSearchParams();
|
|
438
438
|
Object.entries(options).forEach(([key, value]) => {
|
|
439
|
-
if (value !== undefined && key !==
|
|
439
|
+
if (value !== undefined && key !== "project_id" && key !== "merge_request_iid") {
|
|
440
440
|
if (Array.isArray(value)) {
|
|
441
|
-
body.set(key, value.join(
|
|
441
|
+
body.set(key, value.join(","));
|
|
442
442
|
}
|
|
443
443
|
else {
|
|
444
444
|
body.set(key, String(value));
|
|
@@ -447,10 +447,10 @@ exports.mrsToolRegistry = new Map([
|
|
|
447
447
|
});
|
|
448
448
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}`;
|
|
449
449
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
450
|
-
method:
|
|
450
|
+
method: "PUT",
|
|
451
451
|
headers: {
|
|
452
452
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
453
|
-
|
|
453
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
454
454
|
},
|
|
455
455
|
body: body.toString(),
|
|
456
456
|
});
|
|
@@ -463,27 +463,27 @@ exports.mrsToolRegistry = new Map([
|
|
|
463
463
|
},
|
|
464
464
|
],
|
|
465
465
|
[
|
|
466
|
-
|
|
466
|
+
"create_merge_request_thread",
|
|
467
467
|
{
|
|
468
|
-
name:
|
|
469
|
-
description:
|
|
468
|
+
name: "create_merge_request_thread",
|
|
469
|
+
description: "Start a new discussion thread on a merge request for focused conversation. Use to raise specific concerns, ask questions about code sections, or initiate design discussions. Threads can be resolved when addressed.",
|
|
470
470
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateMergeRequestThreadSchema),
|
|
471
471
|
handler: async (args) => {
|
|
472
472
|
const options = schema_1.CreateMergeRequestThreadSchema.parse(args);
|
|
473
473
|
const body = new URLSearchParams();
|
|
474
|
-
body.set(
|
|
474
|
+
body.set("body", options.body);
|
|
475
475
|
if (options.position) {
|
|
476
|
-
body.set(
|
|
476
|
+
body.set("position", JSON.stringify(options.position));
|
|
477
477
|
}
|
|
478
478
|
if (options.commit_id) {
|
|
479
|
-
body.set(
|
|
479
|
+
body.set("commit_id", options.commit_id);
|
|
480
480
|
}
|
|
481
481
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/discussions`;
|
|
482
482
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
483
|
-
method:
|
|
483
|
+
method: "POST",
|
|
484
484
|
headers: {
|
|
485
485
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
486
|
-
|
|
486
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
487
487
|
},
|
|
488
488
|
body: body.toString(),
|
|
489
489
|
});
|
|
@@ -496,21 +496,21 @@ exports.mrsToolRegistry = new Map([
|
|
|
496
496
|
},
|
|
497
497
|
],
|
|
498
498
|
[
|
|
499
|
-
|
|
499
|
+
"update_merge_request_note",
|
|
500
500
|
{
|
|
501
|
-
name:
|
|
502
|
-
description:
|
|
501
|
+
name: "update_merge_request_note",
|
|
502
|
+
description: "Edit an existing comment within a merge request discussion thread. Use to correct mistakes, clarify points, or update information in previous comments. Maintains discussion history while allowing content refinement.",
|
|
503
503
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateMergeRequestNoteSchema),
|
|
504
504
|
handler: async (args) => {
|
|
505
505
|
const options = schema_1.UpdateMergeRequestNoteSchema.parse(args);
|
|
506
506
|
const body = new URLSearchParams();
|
|
507
|
-
body.set(
|
|
507
|
+
body.set("body", options.body);
|
|
508
508
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/notes/${options.note_id}`;
|
|
509
509
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
510
|
-
method:
|
|
510
|
+
method: "PUT",
|
|
511
511
|
headers: {
|
|
512
512
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
513
|
-
|
|
513
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
514
514
|
},
|
|
515
515
|
body: body.toString(),
|
|
516
516
|
});
|
|
@@ -523,24 +523,24 @@ exports.mrsToolRegistry = new Map([
|
|
|
523
523
|
},
|
|
524
524
|
],
|
|
525
525
|
[
|
|
526
|
-
|
|
526
|
+
"create_merge_request_note",
|
|
527
527
|
{
|
|
528
|
-
name:
|
|
529
|
-
description:
|
|
528
|
+
name: "create_merge_request_note",
|
|
529
|
+
description: "Reply to an existing discussion thread in a merge request. Use to continue conversations, provide answers, or add context to ongoing discussions. Keeps related comments organized in threaded format.",
|
|
530
530
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateMergeRequestNoteSchema),
|
|
531
531
|
handler: async (args) => {
|
|
532
532
|
const options = schema_1.CreateMergeRequestNoteSchema.parse(args);
|
|
533
533
|
const body = new URLSearchParams();
|
|
534
|
-
body.set(
|
|
534
|
+
body.set("body", options.body);
|
|
535
535
|
if (options.created_at) {
|
|
536
|
-
body.set(
|
|
536
|
+
body.set("created_at", options.created_at);
|
|
537
537
|
}
|
|
538
538
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/discussions/${options.discussion_id}/notes`;
|
|
539
539
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
540
|
-
method:
|
|
540
|
+
method: "POST",
|
|
541
541
|
headers: {
|
|
542
542
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
543
|
-
|
|
543
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
544
544
|
},
|
|
545
545
|
body: body.toString(),
|
|
546
546
|
});
|
|
@@ -553,24 +553,24 @@ exports.mrsToolRegistry = new Map([
|
|
|
553
553
|
},
|
|
554
554
|
],
|
|
555
555
|
[
|
|
556
|
-
|
|
556
|
+
"update_draft_note",
|
|
557
557
|
{
|
|
558
|
-
name:
|
|
559
|
-
description:
|
|
558
|
+
name: "update_draft_note",
|
|
559
|
+
description: "Modify a draft note before publishing to refine review feedback. Use to edit, improve, or correct draft comments based on further code examination. Changes are only visible to the author until the note is published.",
|
|
560
560
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateDraftNoteSchema),
|
|
561
561
|
handler: async (args) => {
|
|
562
562
|
const options = schema_1.UpdateDraftNoteSchema.parse(args);
|
|
563
563
|
const body = new URLSearchParams();
|
|
564
|
-
body.set(
|
|
564
|
+
body.set("note", options.note);
|
|
565
565
|
if (options.position) {
|
|
566
|
-
body.set(
|
|
566
|
+
body.set("position", JSON.stringify(options.position));
|
|
567
567
|
}
|
|
568
568
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/draft_notes/${options.draft_note_id}`;
|
|
569
569
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
570
|
-
method:
|
|
570
|
+
method: "PUT",
|
|
571
571
|
headers: {
|
|
572
572
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
573
|
-
|
|
573
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
574
574
|
},
|
|
575
575
|
body: body.toString(),
|
|
576
576
|
});
|
|
@@ -583,16 +583,16 @@ exports.mrsToolRegistry = new Map([
|
|
|
583
583
|
},
|
|
584
584
|
],
|
|
585
585
|
[
|
|
586
|
-
|
|
586
|
+
"delete_draft_note",
|
|
587
587
|
{
|
|
588
|
-
name:
|
|
588
|
+
name: "delete_draft_note",
|
|
589
589
|
description: "Remove a draft note that is no longer needed or relevant. Use to clean up draft feedback that won't be published or to start fresh with review comments. Only the author can delete their own draft notes.",
|
|
590
590
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.DeleteDraftNoteSchema),
|
|
591
591
|
handler: async (args) => {
|
|
592
592
|
const options = schema_1.DeleteDraftNoteSchema.parse(args);
|
|
593
593
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(options.project_id)}/merge_requests/${options.merge_request_iid}/draft_notes/${options.draft_note_id}`;
|
|
594
594
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
595
|
-
method:
|
|
595
|
+
method: "DELETE",
|
|
596
596
|
headers: {
|
|
597
597
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
598
598
|
},
|
|
@@ -600,21 +600,21 @@ exports.mrsToolRegistry = new Map([
|
|
|
600
600
|
if (!response.ok) {
|
|
601
601
|
throw new Error(`GitLab API error: ${response.status} ${response.statusText}`);
|
|
602
602
|
}
|
|
603
|
-
return { success: true, message:
|
|
603
|
+
return { success: true, message: "Draft note deleted successfully" };
|
|
604
604
|
},
|
|
605
605
|
},
|
|
606
606
|
],
|
|
607
607
|
]);
|
|
608
608
|
function getMrsReadOnlyToolNames() {
|
|
609
609
|
return [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
610
|
+
"get_branch_diffs",
|
|
611
|
+
"get_merge_request",
|
|
612
|
+
"get_merge_request_diffs",
|
|
613
|
+
"list_merge_request_diffs",
|
|
614
|
+
"mr_discussions",
|
|
615
|
+
"get_draft_note",
|
|
616
|
+
"list_draft_notes",
|
|
617
|
+
"list_merge_requests",
|
|
618
618
|
];
|
|
619
619
|
}
|
|
620
620
|
function getMrsToolDefinitions() {
|
|
@@ -623,7 +623,7 @@ function getMrsToolDefinitions() {
|
|
|
623
623
|
function getFilteredMrsTools(readOnlyMode = false) {
|
|
624
624
|
if (readOnlyMode) {
|
|
625
625
|
const readOnlyNames = getMrsReadOnlyToolNames();
|
|
626
|
-
return Array.from(exports.mrsToolRegistry.values()).filter(
|
|
626
|
+
return Array.from(exports.mrsToolRegistry.values()).filter(tool => readOnlyNames.includes(tool.name));
|
|
627
627
|
}
|
|
628
628
|
return getMrsToolDefinitions();
|
|
629
629
|
}
|