@zereight/mcp-gitlab 2.0.35 → 2.1.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.
@@ -0,0 +1,1172 @@
1
+ import { zodToJsonSchema } from "zod-to-json-schema";
2
+ import { toJSONSchema } from "../utils/schema.js";
3
+ import { USE_GITLAB_WIKI, USE_MILESTONE, USE_PIPELINE, } from "../config.js";
4
+ import { ApproveMergeRequestSchema, BulkPublishDraftNotesSchema, CancelPipelineJobSchema, CancelPipelineSchema, ConvertWorkItemTypeSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateGroupWikiPageSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateLabelSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestNoteSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateReleaseEvidenceSchema, CreateReleaseSchema, CreateRepositorySchema, CreateTimelineEventSchema, CreateWikiPageSchema, CreateWorkItemNoteSchema, CreateWorkItemSchema, DeleteDraftNoteSchema, DeleteGroupWikiPageSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteLabelSchema, DeleteMergeRequestDiscussionNoteSchema, DeleteMergeRequestNoteSchema, DeleteProjectMilestoneSchema, DeleteReleaseSchema, DeleteWikiPageSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, DownloadReleaseAssetSchema, EditProjectMilestoneSchema, ExecuteGraphQLSchema, ForkRepositorySchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetDeploymentSchema, GetDraftNoteSchema, GetEnvironmentSchema, GetFileContentsSchema, GetGroupWikiPageSchema, GetIssueLinkSchema, GetIssueSchema, GetJobArtifactFileSchema, GetLabelSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GetMergeRequestDiffsSchema, GetMergeRequestFileDiffSchema, GetMergeRequestNoteSchema, GetMergeRequestNotesSchema, GetMergeRequestSchema, GetMergeRequestVersionSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetNamespaceSchema, GetPipelineJobOutputSchema, GetPipelineSchema, GetProjectEventsSchema, GetProjectMilestoneSchema, GetProjectSchema, GetReleaseSchema, GetRepositoryTreeSchema, GetTimelineEventsSchema, GetUsersSchema, GetWebhookEventSchema, GetWikiPageSchema, GetWorkItemSchema, ListCommitsSchema, ListCustomFieldDefinitionsSchema, ListDeploymentsSchema, ListDraftNotesSchema, ListEnvironmentsSchema, ListEventsSchema, ListGroupIterationsSchema, ListGroupProjectsSchema, ListGroupWikiPagesSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListJobArtifactsSchema, ListLabelsSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiffsSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestVersionsSchema, ListMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelineTriggerJobsSchema, ListPipelinesSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListReleasesSchema, ListWebhookEventsSchema, ListWebhooksSchema, ListWikiPagesSchema, ListWorkItemNotesSchema, ListWorkItemStatusesSchema, ListWorkItemsSchema, MarkdownUploadSchema, MergeMergeRequestSchema, MoveWorkItemSchema, MyIssuesSchema, PlayPipelineJobSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, ResolveMergeRequestThreadSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UnapproveMergeRequestSchema, UpdateDraftNoteSchema, UpdateGroupWikiPageSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateLabelSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateReleaseSchema, UpdateWikiPageSchema, UpdateWorkItemSchema, VerifyNamespaceSchema, } from "../schemas.js";
5
+ // Define all available tools
6
+ export const allTools = [
7
+ {
8
+ name: "merge_merge_request",
9
+ description: "Merge a merge request",
10
+ inputSchema: toJSONSchema(MergeMergeRequestSchema),
11
+ },
12
+ {
13
+ name: "approve_merge_request",
14
+ description: "Approve a merge request",
15
+ inputSchema: toJSONSchema(ApproveMergeRequestSchema),
16
+ },
17
+ {
18
+ name: "unapprove_merge_request",
19
+ description: "Unapprove a merge request",
20
+ inputSchema: toJSONSchema(UnapproveMergeRequestSchema),
21
+ },
22
+ {
23
+ name: "get_merge_request_approval_state",
24
+ description: "Get merge request approval details including approvers",
25
+ inputSchema: toJSONSchema(GetMergeRequestApprovalStateSchema),
26
+ },
27
+ {
28
+ name: "get_merge_request_conflicts",
29
+ description: "Get the conflicts of a merge request",
30
+ inputSchema: toJSONSchema(GetMergeRequestConflictsSchema),
31
+ },
32
+ {
33
+ name: "execute_graphql",
34
+ description: "Execute a GitLab GraphQL query",
35
+ inputSchema: zodToJsonSchema(ExecuteGraphQLSchema),
36
+ },
37
+ {
38
+ name: "create_or_update_file",
39
+ description: "Create or update a file in a GitLab project",
40
+ inputSchema: toJSONSchema(CreateOrUpdateFileSchema),
41
+ },
42
+ {
43
+ name: "search_repositories",
44
+ description: "Search for GitLab projects",
45
+ inputSchema: toJSONSchema(SearchRepositoriesSchema),
46
+ },
47
+ {
48
+ name: "create_repository",
49
+ description: "Create a new GitLab project",
50
+ inputSchema: toJSONSchema(CreateRepositorySchema),
51
+ },
52
+ {
53
+ name: "get_file_contents",
54
+ description: "Get contents of a file or directory from a GitLab project",
55
+ inputSchema: toJSONSchema(GetFileContentsSchema),
56
+ },
57
+ {
58
+ name: "push_files",
59
+ description: "Push multiple files in a single commit",
60
+ inputSchema: toJSONSchema(PushFilesSchema),
61
+ },
62
+ {
63
+ name: "create_issue",
64
+ description: "Create a new issue",
65
+ inputSchema: toJSONSchema(CreateIssueSchema),
66
+ },
67
+ {
68
+ name: "create_merge_request",
69
+ description: "Create a new merge request",
70
+ inputSchema: toJSONSchema(CreateMergeRequestSchema),
71
+ },
72
+ {
73
+ name: "fork_repository",
74
+ description: "Fork a project to your account or specified namespace",
75
+ inputSchema: toJSONSchema(ForkRepositorySchema),
76
+ },
77
+ {
78
+ name: "create_branch",
79
+ description: "Create a new branch",
80
+ inputSchema: toJSONSchema(CreateBranchSchema),
81
+ },
82
+ {
83
+ name: "get_merge_request",
84
+ description: "Get details of a merge request (mergeRequestIid or branchName required)",
85
+ inputSchema: toJSONSchema(GetMergeRequestSchema),
86
+ },
87
+ {
88
+ name: "get_merge_request_diffs",
89
+ description: "Get the changes/diffs of a merge request (mergeRequestIid or branchName required)",
90
+ inputSchema: toJSONSchema(GetMergeRequestDiffsSchema),
91
+ },
92
+ {
93
+ name: "list_merge_request_changed_files",
94
+ description: "List changed file paths in a merge request without diff content (mergeRequestIid or branchName required)",
95
+ inputSchema: toJSONSchema(ListMergeRequestChangedFilesSchema),
96
+ },
97
+ {
98
+ name: "list_merge_request_diffs",
99
+ description: "List merge request diffs with pagination (mergeRequestIid or branchName required)",
100
+ inputSchema: toJSONSchema(ListMergeRequestDiffsSchema),
101
+ },
102
+ {
103
+ name: "get_merge_request_file_diff",
104
+ description: "Get diffs for specific files from a merge request (mergeRequestIid or branchName required)",
105
+ inputSchema: toJSONSchema(GetMergeRequestFileDiffSchema),
106
+ },
107
+ {
108
+ name: "list_merge_request_versions",
109
+ description: "List all versions of a merge request",
110
+ inputSchema: toJSONSchema(ListMergeRequestVersionsSchema),
111
+ },
112
+ {
113
+ name: "get_merge_request_version",
114
+ description: "Get a specific version of a merge request",
115
+ inputSchema: toJSONSchema(GetMergeRequestVersionSchema),
116
+ },
117
+ {
118
+ name: "get_branch_diffs",
119
+ description: "Get diffs between two branches or commits",
120
+ inputSchema: toJSONSchema(GetBranchDiffsSchema),
121
+ },
122
+ {
123
+ name: "update_merge_request",
124
+ description: "Update a merge request (mergeRequestIid or branchName required)",
125
+ inputSchema: toJSONSchema(UpdateMergeRequestSchema),
126
+ },
127
+ {
128
+ name: "create_note",
129
+ description: "Create a new note (comment) to an issue or merge request",
130
+ inputSchema: toJSONSchema(CreateNoteSchema),
131
+ },
132
+ {
133
+ name: "create_merge_request_thread",
134
+ description: "Create a new thread on a merge request",
135
+ inputSchema: toJSONSchema(CreateMergeRequestThreadSchema),
136
+ },
137
+ {
138
+ name: "resolve_merge_request_thread",
139
+ description: "Resolve a thread on a merge request",
140
+ inputSchema: toJSONSchema(ResolveMergeRequestThreadSchema),
141
+ },
142
+ {
143
+ name: "mr_discussions",
144
+ description: "List discussion items for a merge request",
145
+ inputSchema: toJSONSchema(ListMergeRequestDiscussionsSchema),
146
+ },
147
+ {
148
+ name: "delete_merge_request_discussion_note",
149
+ description: "Delete a discussion note on a merge request",
150
+ inputSchema: toJSONSchema(DeleteMergeRequestDiscussionNoteSchema),
151
+ },
152
+ {
153
+ name: "update_merge_request_discussion_note",
154
+ description: "Update a discussion note on a merge request",
155
+ inputSchema: toJSONSchema(UpdateMergeRequestDiscussionNoteSchema),
156
+ },
157
+ {
158
+ name: "create_merge_request_discussion_note",
159
+ description: "Add a new discussion note to an existing merge request thread",
160
+ inputSchema: toJSONSchema(CreateMergeRequestDiscussionNoteSchema),
161
+ },
162
+ {
163
+ name: "create_merge_request_note",
164
+ description: "Add a new note to a merge request",
165
+ inputSchema: toJSONSchema(CreateMergeRequestNoteSchema),
166
+ },
167
+ {
168
+ name: "delete_merge_request_note",
169
+ description: "Delete an existing merge request note",
170
+ inputSchema: toJSONSchema(DeleteMergeRequestNoteSchema),
171
+ },
172
+ {
173
+ name: "get_merge_request_note",
174
+ description: "Get a specific note for a merge request",
175
+ inputSchema: toJSONSchema(GetMergeRequestNoteSchema),
176
+ },
177
+ {
178
+ name: "get_merge_request_notes",
179
+ description: "List notes for a merge request",
180
+ inputSchema: toJSONSchema(GetMergeRequestNotesSchema),
181
+ },
182
+ {
183
+ name: "update_merge_request_note",
184
+ description: "Modify an existing merge request note",
185
+ inputSchema: toJSONSchema(UpdateMergeRequestNoteSchema),
186
+ },
187
+ {
188
+ name: "get_draft_note",
189
+ description: "Get a single draft note from a merge request",
190
+ inputSchema: toJSONSchema(GetDraftNoteSchema),
191
+ },
192
+ {
193
+ name: "list_draft_notes",
194
+ description: "List draft notes for a merge request",
195
+ inputSchema: toJSONSchema(ListDraftNotesSchema),
196
+ },
197
+ {
198
+ name: "create_draft_note",
199
+ description: "Create a draft note for a merge request",
200
+ inputSchema: toJSONSchema(CreateDraftNoteSchema),
201
+ },
202
+ {
203
+ name: "update_draft_note",
204
+ description: "Update an existing draft note",
205
+ inputSchema: toJSONSchema(UpdateDraftNoteSchema),
206
+ },
207
+ {
208
+ name: "delete_draft_note",
209
+ description: "Delete a draft note",
210
+ inputSchema: toJSONSchema(DeleteDraftNoteSchema),
211
+ },
212
+ {
213
+ name: "publish_draft_note",
214
+ description: "Publish a single draft note",
215
+ inputSchema: toJSONSchema(PublishDraftNoteSchema),
216
+ },
217
+ {
218
+ name: "bulk_publish_draft_notes",
219
+ description: "Publish all draft notes for a merge request",
220
+ inputSchema: toJSONSchema(BulkPublishDraftNotesSchema),
221
+ },
222
+ {
223
+ name: "update_issue_note",
224
+ description: "Modify an existing issue thread note",
225
+ inputSchema: toJSONSchema(UpdateIssueNoteSchema),
226
+ },
227
+ {
228
+ name: "create_issue_note",
229
+ description: "Add a note to an issue, optionally replying to a discussion thread",
230
+ inputSchema: toJSONSchema(CreateIssueNoteSchema),
231
+ },
232
+ {
233
+ name: "list_issues",
234
+ description: "List issues (default: created by current user; use scope='all' for all)",
235
+ inputSchema: toJSONSchema(ListIssuesSchema),
236
+ },
237
+ {
238
+ name: "my_issues",
239
+ description: "List issues assigned to the authenticated user",
240
+ inputSchema: toJSONSchema(MyIssuesSchema),
241
+ },
242
+ {
243
+ name: "get_issue",
244
+ description: "Get details of a specific issue",
245
+ inputSchema: toJSONSchema(GetIssueSchema),
246
+ },
247
+ {
248
+ name: "update_issue",
249
+ description: "Update an issue",
250
+ inputSchema: toJSONSchema(UpdateIssueSchema),
251
+ },
252
+ {
253
+ name: "delete_issue",
254
+ description: "Delete an issue",
255
+ inputSchema: toJSONSchema(DeleteIssueSchema),
256
+ },
257
+ {
258
+ name: "list_issue_links",
259
+ description: "List all issue links for a specific issue",
260
+ inputSchema: toJSONSchema(ListIssueLinksSchema),
261
+ },
262
+ {
263
+ name: "list_issue_discussions",
264
+ description: "List discussions for an issue",
265
+ inputSchema: toJSONSchema(ListIssueDiscussionsSchema),
266
+ },
267
+ {
268
+ name: "get_issue_link",
269
+ description: "Get a specific issue link",
270
+ inputSchema: toJSONSchema(GetIssueLinkSchema),
271
+ },
272
+ {
273
+ name: "create_issue_link",
274
+ description: "Create an issue link between two issues",
275
+ inputSchema: toJSONSchema(CreateIssueLinkSchema),
276
+ },
277
+ {
278
+ name: "delete_issue_link",
279
+ description: "Delete an issue link",
280
+ inputSchema: toJSONSchema(DeleteIssueLinkSchema),
281
+ },
282
+ {
283
+ name: "list_namespaces",
284
+ description: "List all namespaces available to the current user",
285
+ inputSchema: toJSONSchema(ListNamespacesSchema),
286
+ },
287
+ {
288
+ name: "get_namespace",
289
+ description: "Get details of a namespace by ID or path",
290
+ inputSchema: toJSONSchema(GetNamespaceSchema),
291
+ },
292
+ {
293
+ name: "verify_namespace",
294
+ description: "Verify if a namespace path exists",
295
+ inputSchema: toJSONSchema(VerifyNamespaceSchema),
296
+ },
297
+ {
298
+ name: "get_project",
299
+ description: "Get details of a specific project",
300
+ inputSchema: toJSONSchema(GetProjectSchema),
301
+ },
302
+ {
303
+ name: "list_projects",
304
+ description: "List projects accessible by the current user",
305
+ inputSchema: toJSONSchema(ListProjectsSchema),
306
+ },
307
+ {
308
+ name: "list_project_members",
309
+ description: "List members of a GitLab project",
310
+ inputSchema: toJSONSchema(ListProjectMembersSchema),
311
+ },
312
+ {
313
+ name: "list_labels",
314
+ description: "List labels for a project",
315
+ inputSchema: toJSONSchema(ListLabelsSchema),
316
+ },
317
+ {
318
+ name: "get_label",
319
+ description: "Get a single label from a project",
320
+ inputSchema: toJSONSchema(GetLabelSchema),
321
+ },
322
+ {
323
+ name: "create_label",
324
+ description: "Create a new label in a project",
325
+ inputSchema: toJSONSchema(CreateLabelSchema),
326
+ },
327
+ {
328
+ name: "update_label",
329
+ description: "Update an existing label in a project",
330
+ inputSchema: toJSONSchema(UpdateLabelSchema),
331
+ },
332
+ {
333
+ name: "delete_label",
334
+ description: "Delete a label from a project",
335
+ inputSchema: toJSONSchema(DeleteLabelSchema),
336
+ },
337
+ {
338
+ name: "list_group_projects",
339
+ description: "List projects in a group",
340
+ inputSchema: toJSONSchema(ListGroupProjectsSchema),
341
+ },
342
+ {
343
+ name: "list_wiki_pages",
344
+ description: "List wiki pages in a project",
345
+ inputSchema: toJSONSchema(ListWikiPagesSchema),
346
+ },
347
+ {
348
+ name: "get_wiki_page",
349
+ description: "Get details of a specific wiki page",
350
+ inputSchema: toJSONSchema(GetWikiPageSchema),
351
+ },
352
+ {
353
+ name: "create_wiki_page",
354
+ description: "Create a wiki page in a project",
355
+ inputSchema: toJSONSchema(CreateWikiPageSchema),
356
+ },
357
+ {
358
+ name: "update_wiki_page",
359
+ description: "Update a wiki page in a project",
360
+ inputSchema: toJSONSchema(UpdateWikiPageSchema),
361
+ },
362
+ {
363
+ name: "delete_wiki_page",
364
+ description: "Delete a wiki page from a project",
365
+ inputSchema: toJSONSchema(DeleteWikiPageSchema),
366
+ },
367
+ {
368
+ name: "list_group_wiki_pages",
369
+ description: "List wiki pages in a group",
370
+ inputSchema: toJSONSchema(ListGroupWikiPagesSchema),
371
+ },
372
+ {
373
+ name: "get_group_wiki_page",
374
+ description: "Get details of a specific group wiki page",
375
+ inputSchema: toJSONSchema(GetGroupWikiPageSchema),
376
+ },
377
+ {
378
+ name: "create_group_wiki_page",
379
+ description: "Create a wiki page in a group",
380
+ inputSchema: toJSONSchema(CreateGroupWikiPageSchema),
381
+ },
382
+ {
383
+ name: "update_group_wiki_page",
384
+ description: "Update a wiki page in a group",
385
+ inputSchema: toJSONSchema(UpdateGroupWikiPageSchema),
386
+ },
387
+ {
388
+ name: "delete_group_wiki_page",
389
+ description: "Delete a wiki page from a group",
390
+ inputSchema: toJSONSchema(DeleteGroupWikiPageSchema),
391
+ },
392
+ {
393
+ name: "get_repository_tree",
394
+ description: "List files and directories in a repository",
395
+ inputSchema: toJSONSchema(GetRepositoryTreeSchema),
396
+ },
397
+ {
398
+ name: "list_pipelines",
399
+ description: "List pipelines with filtering options",
400
+ inputSchema: toJSONSchema(ListPipelinesSchema),
401
+ },
402
+ {
403
+ name: "get_pipeline",
404
+ description: "Get details of a specific pipeline",
405
+ inputSchema: toJSONSchema(GetPipelineSchema),
406
+ },
407
+ {
408
+ name: "list_deployments",
409
+ description: "List deployments with filtering options",
410
+ inputSchema: toJSONSchema(ListDeploymentsSchema),
411
+ },
412
+ {
413
+ name: "get_deployment",
414
+ description: "Get details of a specific deployment",
415
+ inputSchema: toJSONSchema(GetDeploymentSchema),
416
+ },
417
+ {
418
+ name: "list_environments",
419
+ description: "List environments in a project",
420
+ inputSchema: toJSONSchema(ListEnvironmentsSchema),
421
+ },
422
+ {
423
+ name: "get_environment",
424
+ description: "Get details of a specific environment",
425
+ inputSchema: toJSONSchema(GetEnvironmentSchema),
426
+ },
427
+ {
428
+ name: "list_pipeline_jobs",
429
+ description: "List all jobs in a specific pipeline",
430
+ inputSchema: toJSONSchema(ListPipelineJobsSchema),
431
+ },
432
+ {
433
+ name: "list_pipeline_trigger_jobs",
434
+ description: "List trigger jobs (bridges) in a pipeline",
435
+ inputSchema: toJSONSchema(ListPipelineTriggerJobsSchema),
436
+ },
437
+ {
438
+ name: "get_pipeline_job",
439
+ description: "Get details of a GitLab pipeline job number",
440
+ inputSchema: toJSONSchema(GetPipelineJobOutputSchema),
441
+ },
442
+ {
443
+ name: "get_pipeline_job_output",
444
+ description: "Get the output/trace of a pipeline job with optional pagination",
445
+ inputSchema: toJSONSchema(GetPipelineJobOutputSchema),
446
+ },
447
+ {
448
+ name: "create_pipeline",
449
+ description: "Create a new pipeline for a branch or tag",
450
+ inputSchema: toJSONSchema(CreatePipelineSchema),
451
+ },
452
+ {
453
+ name: "retry_pipeline",
454
+ description: "Retry a failed or canceled pipeline",
455
+ inputSchema: toJSONSchema(RetryPipelineSchema),
456
+ },
457
+ {
458
+ name: "cancel_pipeline",
459
+ description: "Cancel a running pipeline",
460
+ inputSchema: toJSONSchema(CancelPipelineSchema),
461
+ },
462
+ {
463
+ name: "play_pipeline_job",
464
+ description: "Run a manual pipeline job",
465
+ inputSchema: toJSONSchema(PlayPipelineJobSchema),
466
+ },
467
+ {
468
+ name: "retry_pipeline_job",
469
+ description: "Retry a failed or canceled pipeline job",
470
+ inputSchema: toJSONSchema(RetryPipelineJobSchema),
471
+ },
472
+ {
473
+ name: "cancel_pipeline_job",
474
+ description: "Cancel a running pipeline job",
475
+ inputSchema: toJSONSchema(CancelPipelineJobSchema),
476
+ },
477
+ {
478
+ name: "list_job_artifacts",
479
+ description: "List artifact files in a job's archive",
480
+ inputSchema: toJSONSchema(ListJobArtifactsSchema),
481
+ },
482
+ {
483
+ name: "download_job_artifacts",
484
+ description: "Download job artifact archive (zip) to a local path",
485
+ inputSchema: toJSONSchema(DownloadJobArtifactsSchema),
486
+ },
487
+ {
488
+ name: "get_job_artifact_file",
489
+ description: "Get content of a single file from a job's artifacts",
490
+ inputSchema: toJSONSchema(GetJobArtifactFileSchema),
491
+ },
492
+ {
493
+ name: "list_merge_requests",
494
+ description: "List merge requests (without project_id: user's MRs; with project_id: project MRs)",
495
+ inputSchema: toJSONSchema(ListMergeRequestsSchema),
496
+ },
497
+ {
498
+ name: "list_milestones",
499
+ description: "List milestones with filtering options",
500
+ inputSchema: toJSONSchema(ListProjectMilestonesSchema),
501
+ },
502
+ {
503
+ name: "get_milestone",
504
+ description: "Get details of a specific milestone",
505
+ inputSchema: toJSONSchema(GetProjectMilestoneSchema),
506
+ },
507
+ {
508
+ name: "create_milestone",
509
+ description: "Create a new milestone",
510
+ inputSchema: toJSONSchema(CreateProjectMilestoneSchema),
511
+ },
512
+ {
513
+ name: "edit_milestone",
514
+ description: "Edit an existing milestone",
515
+ inputSchema: toJSONSchema(EditProjectMilestoneSchema),
516
+ },
517
+ {
518
+ name: "delete_milestone",
519
+ description: "Delete a milestone",
520
+ inputSchema: toJSONSchema(DeleteProjectMilestoneSchema),
521
+ },
522
+ {
523
+ name: "get_milestone_issue",
524
+ description: "Get issues associated with a specific milestone",
525
+ inputSchema: toJSONSchema(GetMilestoneIssuesSchema),
526
+ },
527
+ {
528
+ name: "get_milestone_merge_requests",
529
+ description: "Get merge requests associated with a specific milestone",
530
+ inputSchema: toJSONSchema(GetMilestoneMergeRequestsSchema),
531
+ },
532
+ {
533
+ name: "promote_milestone",
534
+ description: "Promote a milestone to the next stage",
535
+ inputSchema: toJSONSchema(PromoteProjectMilestoneSchema),
536
+ },
537
+ {
538
+ name: "get_milestone_burndown_events",
539
+ description: "Get burndown events for a specific milestone",
540
+ inputSchema: toJSONSchema(GetMilestoneBurndownEventsSchema),
541
+ },
542
+ {
543
+ name: "get_users",
544
+ description: "Get GitLab user details by usernames",
545
+ inputSchema: toJSONSchema(GetUsersSchema),
546
+ },
547
+ {
548
+ name: "list_commits",
549
+ description: "List repository commits with filtering options",
550
+ inputSchema: toJSONSchema(ListCommitsSchema),
551
+ },
552
+ {
553
+ name: "get_commit",
554
+ description: "Get details of a specific commit",
555
+ inputSchema: toJSONSchema(GetCommitSchema),
556
+ },
557
+ {
558
+ name: "get_commit_diff",
559
+ description: "Get changes/diffs of a specific commit",
560
+ inputSchema: toJSONSchema(GetCommitDiffSchema),
561
+ },
562
+ {
563
+ name: "list_group_iterations",
564
+ description: "List group iterations with filtering options",
565
+ inputSchema: toJSONSchema(ListGroupIterationsSchema),
566
+ },
567
+ {
568
+ name: "upload_markdown",
569
+ description: "Upload a file for use in markdown content",
570
+ inputSchema: toJSONSchema(MarkdownUploadSchema),
571
+ },
572
+ {
573
+ name: "download_attachment",
574
+ description: "Download an uploaded file from a project (images returned as base64; use local_path to save to disk)",
575
+ inputSchema: toJSONSchema(DownloadAttachmentSchema),
576
+ },
577
+ {
578
+ name: "list_events",
579
+ description: "List events for the authenticated user (before/after: YYYY-MM-DD)",
580
+ inputSchema: toJSONSchema(ListEventsSchema),
581
+ },
582
+ {
583
+ name: "get_project_events",
584
+ description: "List events for a project (before/after: YYYY-MM-DD)",
585
+ inputSchema: toJSONSchema(GetProjectEventsSchema),
586
+ },
587
+ {
588
+ name: "list_releases",
589
+ description: "List all releases for a project",
590
+ inputSchema: toJSONSchema(ListReleasesSchema),
591
+ },
592
+ {
593
+ name: "get_release",
594
+ description: "Get a release by tag name",
595
+ inputSchema: toJSONSchema(GetReleaseSchema),
596
+ },
597
+ {
598
+ name: "create_release",
599
+ description: "Create a new release",
600
+ inputSchema: toJSONSchema(CreateReleaseSchema),
601
+ },
602
+ {
603
+ name: "update_release",
604
+ description: "Update an existing release",
605
+ inputSchema: toJSONSchema(UpdateReleaseSchema),
606
+ },
607
+ {
608
+ name: "delete_release",
609
+ description: "Delete a release (does not delete the tag)",
610
+ inputSchema: toJSONSchema(DeleteReleaseSchema),
611
+ },
612
+ {
613
+ name: "create_release_evidence",
614
+ description: "Create release evidence (Premium/Ultimate)",
615
+ inputSchema: toJSONSchema(CreateReleaseEvidenceSchema),
616
+ },
617
+ {
618
+ name: "download_release_asset",
619
+ description: "Download a release asset file by direct asset path",
620
+ inputSchema: toJSONSchema(DownloadReleaseAssetSchema),
621
+ },
622
+ // --- Work item tools (GraphQL-based) ---
623
+ {
624
+ name: "get_work_item",
625
+ description: "Get a work item with full details including status, hierarchy, type, and widgets",
626
+ inputSchema: toJSONSchema(GetWorkItemSchema),
627
+ },
628
+ {
629
+ name: "list_work_items",
630
+ description: "List work items with filters (type, state, search, assignees, labels)",
631
+ inputSchema: toJSONSchema(ListWorkItemsSchema),
632
+ },
633
+ {
634
+ name: "create_work_item",
635
+ description: "Create a work item (issue, task, incident, epic, etc.) with full field support",
636
+ inputSchema: toJSONSchema(CreateWorkItemSchema),
637
+ },
638
+ {
639
+ name: "update_work_item",
640
+ description: "Update a work item (title, description, labels, assignees, state, parent, custom fields, etc.)",
641
+ inputSchema: toJSONSchema(UpdateWorkItemSchema),
642
+ },
643
+ {
644
+ name: "convert_work_item_type",
645
+ description: "Convert a work item to a different type",
646
+ inputSchema: toJSONSchema(ConvertWorkItemTypeSchema),
647
+ },
648
+ {
649
+ name: "list_work_item_statuses",
650
+ description: "List available statuses for a work item type (Premium/Ultimate)",
651
+ inputSchema: toJSONSchema(ListWorkItemStatusesSchema),
652
+ },
653
+ {
654
+ name: "list_custom_field_definitions",
655
+ description: "List custom field definitions for a work item type",
656
+ inputSchema: toJSONSchema(ListCustomFieldDefinitionsSchema),
657
+ },
658
+ {
659
+ name: "move_work_item",
660
+ description: "Move a work item to a different project",
661
+ inputSchema: toJSONSchema(MoveWorkItemSchema),
662
+ },
663
+ {
664
+ name: "list_work_item_notes",
665
+ description: "List notes and discussions on a work item",
666
+ inputSchema: toJSONSchema(ListWorkItemNotesSchema),
667
+ },
668
+ {
669
+ name: "create_work_item_note",
670
+ description: "Add a note to a work item (supports Markdown, internal notes, threads)",
671
+ inputSchema: toJSONSchema(CreateWorkItemNoteSchema),
672
+ },
673
+ // --- Incident timeline event tools ---
674
+ {
675
+ name: "get_timeline_events",
676
+ description: "List timeline events for an incident",
677
+ inputSchema: toJSONSchema(GetTimelineEventsSchema),
678
+ },
679
+ {
680
+ name: "create_timeline_event",
681
+ description: "Create a timeline event on an incident",
682
+ inputSchema: toJSONSchema(CreateTimelineEventSchema),
683
+ },
684
+ {
685
+ name: "list_webhooks",
686
+ description: "List webhooks for a project or group",
687
+ inputSchema: toJSONSchema(ListWebhooksSchema),
688
+ },
689
+ {
690
+ name: "list_webhook_events",
691
+ description: "List recent webhook events (past 7 days)",
692
+ inputSchema: toJSONSchema(ListWebhookEventsSchema),
693
+ },
694
+ {
695
+ name: "get_webhook_event",
696
+ description: "Get full details of a specific webhook event",
697
+ inputSchema: toJSONSchema(GetWebhookEventSchema),
698
+ },
699
+ {
700
+ name: "search_code",
701
+ description: "Search for code across all projects (requires advanced search or Zoekt)",
702
+ inputSchema: toJSONSchema(SearchCodeSchema),
703
+ },
704
+ {
705
+ name: "search_project_code",
706
+ description: "Search for code within a specific project (requires advanced search or Zoekt)",
707
+ inputSchema: toJSONSchema(SearchProjectCodeSchema),
708
+ },
709
+ {
710
+ name: "search_group_code",
711
+ description: "Search for code within a specific group (requires advanced search or Zoekt)",
712
+ inputSchema: toJSONSchema(SearchGroupCodeSchema),
713
+ },
714
+ // --- Meta tool: Dynamic tool discovery ---
715
+ {
716
+ name: "discover_tools",
717
+ description: "Discover and activate additional tool categories for this session. Call without arguments to see available categories.",
718
+ inputSchema: {
719
+ type: "object",
720
+ properties: {
721
+ category: {
722
+ type: "string",
723
+ description: "Toolset category to activate (e.g. 'pipelines', 'wiki'). Omit to list available categories.",
724
+ },
725
+ },
726
+ },
727
+ },
728
+ ];
729
+ // Define which tools are read-only
730
+ export const readOnlyTools = new Set([
731
+ "discover_tools",
732
+ "search_repositories",
733
+ "search_code",
734
+ "search_project_code",
735
+ "search_group_code",
736
+ "execute_graphql",
737
+ "get_file_contents",
738
+ "get_merge_request",
739
+ "get_merge_request_diffs",
740
+ "list_merge_request_changed_files",
741
+ "list_merge_request_diffs",
742
+ "get_merge_request_file_diff",
743
+ "list_merge_request_versions",
744
+ "get_merge_request_version",
745
+ "get_branch_diffs",
746
+ "get_merge_request_note",
747
+ "get_merge_request_notes",
748
+ "get_draft_note",
749
+ "list_draft_notes",
750
+ "mr_discussions",
751
+ "list_issues",
752
+ "my_issues",
753
+ "list_merge_requests",
754
+ "get_issue",
755
+ "list_issue_links",
756
+ "list_issue_discussions",
757
+ "get_issue_link",
758
+ "list_namespaces",
759
+ "get_namespace",
760
+ "verify_namespace",
761
+ "get_project",
762
+ "list_projects",
763
+ "list_project_members",
764
+ "get_pipeline",
765
+ "list_pipelines",
766
+ "list_deployments",
767
+ "get_deployment",
768
+ "list_environments",
769
+ "get_environment",
770
+ "list_pipeline_jobs",
771
+ "list_pipeline_trigger_jobs",
772
+ "get_pipeline_job",
773
+ "get_pipeline_job_output",
774
+ "list_job_artifacts",
775
+ "download_job_artifacts",
776
+ "get_job_artifact_file",
777
+ "list_labels",
778
+ "get_label",
779
+ "list_group_projects",
780
+ "get_repository_tree",
781
+ "list_milestones",
782
+ "get_milestone",
783
+ "get_milestone_issue",
784
+ "get_milestone_merge_requests",
785
+ "get_milestone_burndown_events",
786
+ "list_wiki_pages",
787
+ "get_wiki_page",
788
+ "list_group_wiki_pages",
789
+ "get_group_wiki_page",
790
+ "get_users",
791
+ "list_commits",
792
+ "get_commit",
793
+ "get_commit_diff",
794
+ "list_group_iterations",
795
+ "get_group_iteration",
796
+ "download_attachment",
797
+ "list_events",
798
+ "get_project_events",
799
+ "list_releases",
800
+ "get_release",
801
+ "download_release_asset",
802
+ "get_merge_request_approval_state",
803
+ "get_work_item",
804
+ "list_work_items",
805
+ "list_work_item_statuses",
806
+ "list_custom_field_definitions",
807
+ "list_work_item_notes",
808
+ "get_timeline_events",
809
+ "get_merge_request_conflicts",
810
+ "list_webhooks",
811
+ "list_webhook_events",
812
+ "get_webhook_event",
813
+ ]);
814
+ // Define which tools are destructive (data loss potential)
815
+ export const destructiveTools = new Set([
816
+ "delete_issue",
817
+ "delete_issue_link",
818
+ "delete_label",
819
+ "delete_wiki_page",
820
+ "delete_group_wiki_page",
821
+ "delete_milestone",
822
+ "delete_release",
823
+ "delete_merge_request_note",
824
+ "delete_merge_request_discussion_note",
825
+ "delete_draft_note",
826
+ "merge_merge_request",
827
+ "push_files",
828
+ ]);
829
+ // Define which tools are related to wiki and can be toggled by USE_GITLAB_WIKI
830
+ export const wikiToolNames = new Set([
831
+ "list_wiki_pages",
832
+ "get_wiki_page",
833
+ "create_wiki_page",
834
+ "update_wiki_page",
835
+ "delete_wiki_page",
836
+ "list_group_wiki_pages",
837
+ "get_group_wiki_page",
838
+ "create_group_wiki_page",
839
+ "update_group_wiki_page",
840
+ "delete_group_wiki_page",
841
+ "upload_wiki_attachment",
842
+ ]);
843
+ // Define which tools are related to milestones and can be toggled by USE_MILESTONE
844
+ export const milestoneToolNames = new Set([
845
+ "list_milestones",
846
+ "get_milestone",
847
+ "create_milestone",
848
+ "edit_milestone",
849
+ "delete_milestone",
850
+ "get_milestone_issue",
851
+ "get_milestone_merge_requests",
852
+ "promote_milestone",
853
+ "get_milestone_burndown_events",
854
+ ]);
855
+ // Define which tools are related to pipelines and can be toggled by USE_PIPELINE
856
+ export const pipelineToolNames = new Set([
857
+ "list_pipelines",
858
+ "get_pipeline",
859
+ "list_deployments",
860
+ "get_deployment",
861
+ "list_environments",
862
+ "get_environment",
863
+ "list_pipeline_jobs",
864
+ "list_pipeline_trigger_jobs",
865
+ "get_pipeline_job",
866
+ "get_pipeline_job_output",
867
+ "create_pipeline",
868
+ "retry_pipeline",
869
+ "cancel_pipeline",
870
+ "play_pipeline_job",
871
+ "retry_pipeline_job",
872
+ "cancel_pipeline_job",
873
+ "list_job_artifacts",
874
+ "download_job_artifacts",
875
+ "get_job_artifact_file",
876
+ ]);
877
+ export const TOOLSET_DEFINITIONS = [
878
+ {
879
+ id: "merge_requests",
880
+ isDefault: true,
881
+ tools: new Set([
882
+ "merge_merge_request",
883
+ "approve_merge_request",
884
+ "unapprove_merge_request",
885
+ "get_merge_request_approval_state",
886
+ "get_merge_request_conflicts",
887
+ "get_merge_request",
888
+ "get_merge_request_diffs",
889
+ "list_merge_request_changed_files",
890
+ "list_merge_request_diffs",
891
+ "get_merge_request_file_diff",
892
+ "list_merge_request_versions",
893
+ "get_merge_request_version",
894
+ "update_merge_request",
895
+ "create_merge_request",
896
+ "list_merge_requests",
897
+ "get_branch_diffs",
898
+ "mr_discussions",
899
+ "create_merge_request_note",
900
+ "update_merge_request_note",
901
+ "delete_merge_request_note",
902
+ "get_merge_request_note",
903
+ "get_merge_request_notes",
904
+ "delete_merge_request_discussion_note",
905
+ "update_merge_request_discussion_note",
906
+ "create_merge_request_discussion_note",
907
+ "get_draft_note",
908
+ "list_draft_notes",
909
+ "create_draft_note",
910
+ "update_draft_note",
911
+ "delete_draft_note",
912
+ "publish_draft_note",
913
+ "bulk_publish_draft_notes",
914
+ "create_merge_request_thread",
915
+ "resolve_merge_request_thread",
916
+ ]),
917
+ },
918
+ {
919
+ id: "issues",
920
+ isDefault: true,
921
+ tools: new Set([
922
+ "create_issue",
923
+ "list_issues",
924
+ "my_issues",
925
+ "get_issue",
926
+ "update_issue",
927
+ "delete_issue",
928
+ "create_issue_note",
929
+ "update_issue_note",
930
+ "list_issue_links",
931
+ "list_issue_discussions",
932
+ "get_issue_link",
933
+ "create_issue_link",
934
+ "delete_issue_link",
935
+ "create_note",
936
+ ]),
937
+ },
938
+ {
939
+ id: "repositories",
940
+ isDefault: true,
941
+ tools: new Set([
942
+ "search_repositories",
943
+ "create_repository",
944
+ "get_file_contents",
945
+ "push_files",
946
+ "create_or_update_file",
947
+ "fork_repository",
948
+ "get_repository_tree",
949
+ ]),
950
+ },
951
+ {
952
+ id: "branches",
953
+ isDefault: true,
954
+ tools: new Set([
955
+ "create_branch",
956
+ "list_commits",
957
+ "get_commit",
958
+ "get_commit_diff",
959
+ ]),
960
+ },
961
+ {
962
+ id: "projects",
963
+ isDefault: true,
964
+ tools: new Set([
965
+ "get_project",
966
+ "list_projects",
967
+ "list_project_members",
968
+ "list_namespaces",
969
+ "get_namespace",
970
+ "verify_namespace",
971
+ "list_group_projects",
972
+ "list_group_iterations",
973
+ ]),
974
+ },
975
+ {
976
+ id: "labels",
977
+ isDefault: true,
978
+ tools: new Set([
979
+ "list_labels",
980
+ "get_label",
981
+ "create_label",
982
+ "update_label",
983
+ "delete_label",
984
+ ]),
985
+ },
986
+ {
987
+ id: "pipelines",
988
+ isDefault: false,
989
+ tools: new Set([
990
+ "list_pipelines",
991
+ "get_pipeline",
992
+ "list_deployments",
993
+ "get_deployment",
994
+ "list_environments",
995
+ "get_environment",
996
+ "list_pipeline_jobs",
997
+ "list_pipeline_trigger_jobs",
998
+ "get_pipeline_job",
999
+ "get_pipeline_job_output",
1000
+ "create_pipeline",
1001
+ "retry_pipeline",
1002
+ "cancel_pipeline",
1003
+ "play_pipeline_job",
1004
+ "retry_pipeline_job",
1005
+ "cancel_pipeline_job",
1006
+ "list_job_artifacts",
1007
+ "download_job_artifacts",
1008
+ "get_job_artifact_file",
1009
+ ]),
1010
+ },
1011
+ {
1012
+ id: "milestones",
1013
+ isDefault: false,
1014
+ tools: new Set([
1015
+ "list_milestones",
1016
+ "get_milestone",
1017
+ "create_milestone",
1018
+ "edit_milestone",
1019
+ "delete_milestone",
1020
+ "get_milestone_issue",
1021
+ "get_milestone_merge_requests",
1022
+ "promote_milestone",
1023
+ "get_milestone_burndown_events",
1024
+ ]),
1025
+ },
1026
+ {
1027
+ id: "wiki",
1028
+ isDefault: false,
1029
+ tools: new Set([
1030
+ "list_wiki_pages",
1031
+ "get_wiki_page",
1032
+ "create_wiki_page",
1033
+ "update_wiki_page",
1034
+ "delete_wiki_page",
1035
+ "list_group_wiki_pages",
1036
+ "get_group_wiki_page",
1037
+ "create_group_wiki_page",
1038
+ "update_group_wiki_page",
1039
+ "delete_group_wiki_page",
1040
+ ]),
1041
+ },
1042
+ {
1043
+ id: "releases",
1044
+ isDefault: false,
1045
+ tools: new Set([
1046
+ "list_releases",
1047
+ "get_release",
1048
+ "create_release",
1049
+ "update_release",
1050
+ "delete_release",
1051
+ "create_release_evidence",
1052
+ "download_release_asset",
1053
+ ]),
1054
+ },
1055
+ {
1056
+ id: "users",
1057
+ isDefault: true,
1058
+ tools: new Set([
1059
+ "get_users",
1060
+ "list_events",
1061
+ "get_project_events",
1062
+ "upload_markdown",
1063
+ "download_attachment",
1064
+ ]),
1065
+ },
1066
+ {
1067
+ id: "workitems",
1068
+ isDefault: false,
1069
+ tools: new Set([
1070
+ "get_work_item",
1071
+ "list_work_items",
1072
+ "create_work_item",
1073
+ "update_work_item",
1074
+ "convert_work_item_type",
1075
+ "list_work_item_statuses",
1076
+ "list_custom_field_definitions",
1077
+ "move_work_item",
1078
+ "list_work_item_notes",
1079
+ "create_work_item_note",
1080
+ "get_timeline_events",
1081
+ "create_timeline_event",
1082
+ ]),
1083
+ },
1084
+ {
1085
+ id: "webhooks",
1086
+ isDefault: false,
1087
+ tools: new Set([
1088
+ "list_webhooks",
1089
+ "list_webhook_events",
1090
+ "get_webhook_event",
1091
+ ]),
1092
+ },
1093
+ {
1094
+ id: "search",
1095
+ isDefault: false,
1096
+ tools: new Set(["search_code", "search_project_code", "search_group_code"]),
1097
+ },
1098
+ ];
1099
+ // Derived lookup: tool name → toolset ID
1100
+ export const TOOLSET_BY_TOOL_NAME = new Map();
1101
+ for (const def of TOOLSET_DEFINITIONS) {
1102
+ for (const tool of def.tools) {
1103
+ if (TOOLSET_BY_TOOL_NAME.has(tool)) {
1104
+ console.warn(`Tool "${tool}" is defined in multiple toolsets: "${TOOLSET_BY_TOOL_NAME.get(tool)}" and "${def.id}"`);
1105
+ }
1106
+ TOOLSET_BY_TOOL_NAME.set(tool, def.id);
1107
+ }
1108
+ }
1109
+ export const DEFAULT_TOOLSET_IDS = new Set(TOOLSET_DEFINITIONS.filter(d => d.isDefault).map(d => d.id));
1110
+ export const ALL_TOOLSET_IDS = new Set(TOOLSET_DEFINITIONS.map(d => d.id));
1111
+ // Update discover_tools description with all known categories (must be after TOOLSET_DEFINITIONS)
1112
+ const discoverTool = allTools.find(t => t.name === "discover_tools");
1113
+ if (discoverTool) {
1114
+ discoverTool.description = `Discover and activate additional tool categories for this session. Available categories: ${[...ALL_TOOLSET_IDS].join(", ")}. Already-active categories are listed in the response.`;
1115
+ }
1116
+ export function parseEnabledToolsets(raw) {
1117
+ if (!raw || raw.trim() === "") {
1118
+ return DEFAULT_TOOLSET_IDS;
1119
+ }
1120
+ const trimmed = raw.trim().toLowerCase();
1121
+ if (trimmed === "all") {
1122
+ return ALL_TOOLSET_IDS;
1123
+ }
1124
+ const selected = new Set(trimmed
1125
+ .split(",")
1126
+ .map(s => s.trim())
1127
+ .filter((s) => ALL_TOOLSET_IDS.has(s)));
1128
+ if (selected.size === 0) {
1129
+ console.warn(`No valid toolsets found in configuration (${raw}). Falling back to default toolsets.`);
1130
+ return DEFAULT_TOOLSET_IDS;
1131
+ }
1132
+ return selected;
1133
+ }
1134
+ export function parseIndividualTools(raw) {
1135
+ if (!raw || raw.trim() === "") {
1136
+ return new Set();
1137
+ }
1138
+ const allToolNames = new Set(allTools.map((t) => t.name));
1139
+ const parsed = raw
1140
+ .trim()
1141
+ .split(",")
1142
+ .map(s => s.trim().toLowerCase())
1143
+ .filter(Boolean);
1144
+ const unknown = parsed.filter(name => !allToolNames.has(name));
1145
+ if (unknown.length > 0) {
1146
+ console.warn(`Unknown tool names in GITLAB_TOOLS (will be ignored): ${unknown.join(", ")}`);
1147
+ }
1148
+ return new Set(parsed);
1149
+ }
1150
+ export function buildFeatureFlagOverrides() {
1151
+ const overrides = new Set();
1152
+ if (USE_GITLAB_WIKI) {
1153
+ for (const t of wikiToolNames)
1154
+ overrides.add(t);
1155
+ }
1156
+ if (USE_MILESTONE) {
1157
+ for (const t of milestoneToolNames)
1158
+ overrides.add(t);
1159
+ }
1160
+ if (USE_PIPELINE) {
1161
+ for (const t of pipelineToolNames)
1162
+ overrides.add(t);
1163
+ }
1164
+ return overrides;
1165
+ }
1166
+ export function isToolInEnabledToolset(toolName, enabledToolsets) {
1167
+ const toolsetId = TOOLSET_BY_TOOL_NAME.get(toolName);
1168
+ // Tools not in any toolset (e.g. execute_graphql) are excluded by default
1169
+ if (toolsetId === undefined)
1170
+ return false;
1171
+ return enabledToolsets.has(toolsetId);
1172
+ }