@zereight/mcp-gitlab 2.1.51 → 2.1.53

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/build/index.js CHANGED
@@ -110,8 +110,8 @@ CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMerg
110
110
  GitLabDiscussionNoteSchema, // Added
111
111
  GitLabDiscussionSchema,
112
112
  // Draft Notes Schemas
113
- GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema, GitLabMilestonesSchema, GitLabGroupMilestonesSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabDeploymentSchema, GitLabEnvironmentSchema, GitLabPipelineSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema, GitLabTodoSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabSearchBlobResultSchema, GitLabSearchResponseSchema, GitLabTreeItemSchema, GitLabUserSchema, GitLabUsersResponseSchema, GitLabWikiPageSchema, GroupIteration, ListCommitStatusesSchema, ListBranchesSchema, ListCommitsSchema, ListDraftNotesSchema, ListGroupIterationsSchema, ListGroupProjectsSchema, GitLabCiVariableSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListTodosSchema, ListLabelsSchema, ListMergeRequestDiffsSchema, // Added
114
- GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectMilestonesSchema, ListGroupMilestonesSchema, ListProjectsSchema, ListWikiPagesSchema, GetGroupWikiPageSchema, ListGroupWikiPagesSchema, UpdateGroupWikiPageSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalsResponseSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, MarkAllTodosDoneSchema, MarkTodoDoneSchema, PaginatedDiscussionsResponseSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PlayPipelineJobSchema, PushFilesSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestSchema, UpdateWikiPageSchema, VerifyNamespaceSchema, GitLabEventSchema, ListEventsSchema, GetProjectEventsSchema, ExecuteGraphQLSchema, GitLabReleaseSchema, ListReleasesSchema, GetReleaseSchema, CreateReleaseSchema, UpdateReleaseSchema, DeleteReleaseSchema, CreateReleaseEvidenceSchema, DownloadReleaseAssetSchema, ListTagsSchema, GetTagSchema, CreateTagSchema, DeleteTagSchema, GetTagSignatureSchema, GitLabTagSchema, GitLabTagSignatureSchema, GetMergeRequestNotesSchema, GetMergeRequestNoteSchema, DeleteMergeRequestDiscussionNoteSchema, ResolveMergeRequestThreadSchema, GetWorkItemSchema, ListWorkItemsSchema, CreateWorkItemSchema, UpdateWorkItemSchema, ConvertWorkItemTypeSchema, ListWorkItemStatusesSchema, ListWorkItemNotesSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, MoveWorkItemSchema, ListCustomFieldDefinitionsSchema, GetTimelineEventsSchema, CreateTimelineEventSchema, ListWebhooksSchema, ListWebhookEventsSchema, GetWebhookEventSchema, HealthCheckSchema, } from "./schemas.js";
113
+ GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema, GitLabMilestonesSchema, GitLabGroupMilestonesSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabDeploymentSchema, GitLabEnvironmentSchema, GitLabPipelineSchema, GitLabPipelineScheduleSchema, GitLabPipelineScheduleVariableSchema, GitLabPipelineSchedulePlayResultSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema, GitLabTodoSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabSearchBlobResultSchema, GitLabSearchResponseSchema, GitLabTreeItemSchema, GitLabUserSchema, GitLabUsersResponseSchema, GitLabWikiPageSchema, GroupIteration, ListCommitStatusesSchema, ListBranchesSchema, ListCommitsSchema, ListDraftNotesSchema, ListGroupIterationsSchema, ListGroupProjectsSchema, GitLabCiVariableSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListTodosSchema, ListLabelsSchema, ListMergeRequestDiffsSchema, // Added
114
+ GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectMilestonesSchema, ListGroupMilestonesSchema, ListProjectsSchema, ListWikiPagesSchema, GetGroupWikiPageSchema, ListGroupWikiPagesSchema, UpdateGroupWikiPageSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalsResponseSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, MarkAllTodosDoneSchema, MarkTodoDoneSchema, PaginatedDiscussionsResponseSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PlayPipelineJobSchema, PushFilesSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestSchema, UpdateWikiPageSchema, VerifyNamespaceSchema, GitLabEventSchema, ListEventsSchema, GetProjectEventsSchema, ExecuteGraphQLSchema, GitLabReleaseSchema, ListReleasesSchema, GetReleaseSchema, CreateReleaseSchema, UpdateReleaseSchema, DeleteReleaseSchema, CreateReleaseEvidenceSchema, DownloadReleaseAssetSchema, ListTagsSchema, GetTagSchema, CreateTagSchema, DeleteTagSchema, GetTagSignatureSchema, GitLabTagSchema, GitLabTagSignatureSchema, GetMergeRequestNotesSchema, GetMergeRequestNoteSchema, DeleteMergeRequestDiscussionNoteSchema, ResolveMergeRequestThreadSchema, GetWorkItemSchema, ListWorkItemsSchema, CreateWorkItemSchema, UpdateWorkItemSchema, ConvertWorkItemTypeSchema, ListWorkItemStatusesSchema, ListWorkItemNotesSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, MoveWorkItemSchema, ListCustomFieldDefinitionsSchema, GetTimelineEventsSchema, CreateTimelineEventSchema, ListWebhooksSchema, ListWebhookEventsSchema, GetWebhookEventSchema, HealthCheckSchema, } from "./schemas.js";
115
115
  import { randomUUID, timingSafeEqual, } from "node:crypto";
116
116
  import { createLogger } from "./utils/logger.js";
117
117
  const logger = createLogger();
@@ -1381,6 +1381,28 @@ async function markAllTodosDone() {
1381
1381
  });
1382
1382
  await handleGitLabError(response);
1383
1383
  }
1384
+ /**
1385
+ * Serialize merge request list filters onto a URL, honouring GitLab's per-parameter array forms
1386
+ */
1387
+ function appendMergeRequestFilters(url, options) {
1388
+ Object.entries(options).forEach(([key, value]) => {
1389
+ if (value === undefined) {
1390
+ return;
1391
+ }
1392
+ if (key === "labels" && Array.isArray(value)) {
1393
+ url.searchParams.append(key, value.join(","));
1394
+ }
1395
+ else if (key === "approved_by_usernames" && Array.isArray(value)) {
1396
+ // GitLab expects array-bracket form: approved_by_usernames[]=alice&approved_by_usernames[]=bob
1397
+ for (const v of value) {
1398
+ url.searchParams.append(`${key}[]`, String(v));
1399
+ }
1400
+ }
1401
+ else {
1402
+ url.searchParams.append(key, String(value));
1403
+ }
1404
+ });
1405
+ }
1384
1406
  /**
1385
1407
  * List merge requests globally or for a specific GitLab project
1386
1408
  *
@@ -1395,24 +1417,25 @@ async function listMergeRequests(projectId, options = {}) {
1395
1417
  ? `${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(decodedProjectId))}/merge_requests`
1396
1418
  : `${getEffectiveApiUrl()}/merge_requests`;
1397
1419
  const url = new URL(endpoint);
1398
- // Add all query parameters
1399
- Object.entries(options).forEach(([key, value]) => {
1400
- if (value !== undefined) {
1401
- if (key === "labels" && Array.isArray(value)) {
1402
- // Handle array of labels
1403
- url.searchParams.append(key, value.join(","));
1404
- }
1405
- else if (key === "approved_by_usernames" && Array.isArray(value)) {
1406
- // GitLab expects array-bracket form: approved_by_usernames[]=alice&approved_by_usernames[]=bob
1407
- for (const v of value) {
1408
- url.searchParams.append(`${key}[]`, String(v));
1409
- }
1410
- }
1411
- else {
1412
- url.searchParams.append(key, String(value));
1413
- }
1414
- }
1420
+ appendMergeRequestFilters(url, options);
1421
+ const response = await fetch(url.toString(), {
1422
+ ...getFetchConfig(),
1415
1423
  });
1424
+ await handleGitLabError(response);
1425
+ const data = await response.json();
1426
+ return z.array(GitLabMergeRequestSchema).parse(data);
1427
+ }
1428
+ /**
1429
+ * List merge requests across every project of a GitLab group and its subgroups
1430
+ *
1431
+ * @param {string} groupId - The ID or URL-encoded path of the group
1432
+ * @param {Object} options - Optional filtering parameters
1433
+ * @returns {Promise<GitLabMergeRequest[]>} List of merge requests
1434
+ */
1435
+ async function listGroupMergeRequests(groupId, options = {}) {
1436
+ const decodedGroupId = decodeURIComponent(groupId);
1437
+ const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeURIComponent(decodedGroupId)}/merge_requests`);
1438
+ appendMergeRequestFilters(url, options);
1416
1439
  const response = await fetch(url.toString(), {
1417
1440
  ...getFetchConfig(),
1418
1441
  });
@@ -5374,6 +5397,235 @@ async function cancelPipeline(projectId, pipelineId) {
5374
5397
  const data = await response.json();
5375
5398
  return GitLabPipelineSchema.parse(data);
5376
5399
  }
5400
+ /**
5401
+ * List pipeline schedules in a GitLab project
5402
+ *
5403
+ * @param {string} projectId - The ID or URL-encoded path of the project
5404
+ * @param {ListPipelineSchedulesOptions} options - Options for filtering pipeline schedules
5405
+ * @returns {Promise<GitLabPipelineSchedule[]>} List of pipeline schedules
5406
+ */
5407
+ async function listPipelineSchedules(projectId, options = {}) {
5408
+ projectId = decodeURIComponent(projectId); // Decode project ID
5409
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules`);
5410
+ Object.entries(options).forEach(([key, value]) => {
5411
+ if (value !== undefined) {
5412
+ url.searchParams.append(key, value.toString());
5413
+ }
5414
+ });
5415
+ const response = await fetch(url.toString(), {
5416
+ ...getFetchConfig(),
5417
+ });
5418
+ await handleGitLabError(response);
5419
+ const data = await response.json();
5420
+ return z.array(GitLabPipelineScheduleSchema).parse(data);
5421
+ }
5422
+ /**
5423
+ * Get details of a specific pipeline schedule
5424
+ *
5425
+ * @param {string} projectId - The ID or URL-encoded path of the project
5426
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5427
+ * @returns {Promise<GitLabPipelineSchedule>} Pipeline schedule details
5428
+ */
5429
+ async function getPipelineSchedule(projectId, pipelineScheduleId) {
5430
+ projectId = decodeURIComponent(projectId); // Decode project ID
5431
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}`);
5432
+ const response = await fetch(url.toString(), {
5433
+ ...getFetchConfig(),
5434
+ });
5435
+ await handleGitLabError(response);
5436
+ const data = await response.json();
5437
+ return GitLabPipelineScheduleSchema.parse(data);
5438
+ }
5439
+ /**
5440
+ * List the pipelines triggered by a pipeline schedule
5441
+ *
5442
+ * @param {string} projectId - The ID or URL-encoded path of the project
5443
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5444
+ * @param {ListPipelineSchedulePipelinesOptions} options - Pagination options
5445
+ * @returns {Promise<GitLabPipeline[]>} List of pipelines the schedule triggered
5446
+ */
5447
+ async function listPipelineSchedulePipelines(projectId, pipelineScheduleId, options = {}) {
5448
+ projectId = decodeURIComponent(projectId); // Decode project ID
5449
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/pipelines`);
5450
+ Object.entries(options).forEach(([key, value]) => {
5451
+ if (value !== undefined) {
5452
+ url.searchParams.append(key, value.toString());
5453
+ }
5454
+ });
5455
+ const response = await fetch(url.toString(), {
5456
+ ...getFetchConfig(),
5457
+ });
5458
+ await handleGitLabError(response);
5459
+ const data = await response.json();
5460
+ return z.array(GitLabPipelineSchema).parse(data);
5461
+ }
5462
+ /**
5463
+ * Create a new pipeline schedule
5464
+ *
5465
+ * @param {string} projectId - The ID or URL-encoded path of the project
5466
+ * @param {CreatePipelineScheduleOptions} options - The schedule's cron, description, ref and options
5467
+ * @returns {Promise<GitLabPipelineSchedule>} The created pipeline schedule
5468
+ */
5469
+ async function createPipelineSchedule(projectId, options) {
5470
+ projectId = decodeURIComponent(projectId); // Decode project ID
5471
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules`);
5472
+ const response = await fetch(url.toString(), {
5473
+ ...getFetchConfig(),
5474
+ method: "POST",
5475
+ body: JSON.stringify(options),
5476
+ });
5477
+ await handleGitLabError(response);
5478
+ const data = await response.json();
5479
+ return GitLabPipelineScheduleSchema.parse(data);
5480
+ }
5481
+ /**
5482
+ * Update an existing pipeline schedule
5483
+ *
5484
+ * @param {string} projectId - The ID or URL-encoded path of the project
5485
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule to update
5486
+ * @param {UpdatePipelineScheduleOptions} options - The fields to change
5487
+ * @returns {Promise<GitLabPipelineSchedule>} The updated pipeline schedule
5488
+ */
5489
+ async function updatePipelineSchedule(projectId, pipelineScheduleId, options) {
5490
+ projectId = decodeURIComponent(projectId); // Decode project ID
5491
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}`);
5492
+ const response = await fetch(url.toString(), {
5493
+ ...getFetchConfig(),
5494
+ method: "PUT",
5495
+ body: JSON.stringify(options),
5496
+ });
5497
+ await handleGitLabError(response);
5498
+ const data = await response.json();
5499
+ return GitLabPipelineScheduleSchema.parse(data);
5500
+ }
5501
+ /**
5502
+ * Delete a pipeline schedule
5503
+ *
5504
+ * @param {string} projectId - The ID or URL-encoded path of the project
5505
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule to delete
5506
+ * @returns {Promise<void>}
5507
+ */
5508
+ async function deletePipelineSchedule(projectId, pipelineScheduleId) {
5509
+ projectId = decodeURIComponent(projectId); // Decode project ID
5510
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}`);
5511
+ const response = await fetch(url.toString(), {
5512
+ ...getFetchConfig(),
5513
+ method: "DELETE",
5514
+ });
5515
+ await handleGitLabError(response);
5516
+ }
5517
+ /**
5518
+ * Run a pipeline schedule immediately, without changing its next scheduled run
5519
+ *
5520
+ * @param {string} projectId - The ID or URL-encoded path of the project
5521
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule to run
5522
+ * @returns {Promise<GitLabPipelineSchedulePlayResult>} GitLab's acknowledgement message
5523
+ */
5524
+ async function playPipelineSchedule(projectId, pipelineScheduleId) {
5525
+ projectId = decodeURIComponent(projectId); // Decode project ID
5526
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/play`);
5527
+ const response = await fetch(url.toString(), {
5528
+ ...getFetchConfig(),
5529
+ method: "POST",
5530
+ });
5531
+ await handleGitLabError(response);
5532
+ const data = await response.json();
5533
+ return GitLabPipelineSchedulePlayResultSchema.parse(data);
5534
+ }
5535
+ /**
5536
+ * Take ownership of a pipeline schedule
5537
+ *
5538
+ * @param {string} projectId - The ID or URL-encoded path of the project
5539
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5540
+ * @returns {Promise<GitLabPipelineSchedule>} The pipeline schedule with its new owner
5541
+ */
5542
+ async function takeOwnershipPipelineSchedule(projectId, pipelineScheduleId) {
5543
+ projectId = decodeURIComponent(projectId); // Decode project ID
5544
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/take_ownership`);
5545
+ const response = await fetch(url.toString(), {
5546
+ ...getFetchConfig(),
5547
+ method: "POST",
5548
+ });
5549
+ await handleGitLabError(response);
5550
+ const data = await response.json();
5551
+ return GitLabPipelineScheduleSchema.parse(data);
5552
+ }
5553
+ /**
5554
+ * Get a single variable of a pipeline schedule
5555
+ *
5556
+ * @param {string} projectId - The ID or URL-encoded path of the project
5557
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5558
+ * @param {string} key - The key of the variable
5559
+ * @returns {Promise<GitLabPipelineScheduleVariable>} The pipeline schedule variable
5560
+ */
5561
+ async function getPipelineScheduleVariable(projectId, pipelineScheduleId, key) {
5562
+ projectId = decodeURIComponent(projectId); // Decode project ID
5563
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/variables/${encodeGitLabPathSegment(key)}`);
5564
+ const response = await fetch(url.toString(), {
5565
+ ...getFetchConfig(),
5566
+ });
5567
+ await handleGitLabError(response);
5568
+ const data = await response.json();
5569
+ return GitLabPipelineScheduleVariableSchema.parse(data);
5570
+ }
5571
+ /**
5572
+ * Create a variable for a pipeline schedule
5573
+ *
5574
+ * @param {string} projectId - The ID or URL-encoded path of the project
5575
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5576
+ * @param {CreatePipelineScheduleVariableOptions} options - The variable's key, value and type
5577
+ * @returns {Promise<GitLabPipelineScheduleVariable>} The created pipeline schedule variable
5578
+ */
5579
+ async function createPipelineScheduleVariable(projectId, pipelineScheduleId, options) {
5580
+ projectId = decodeURIComponent(projectId); // Decode project ID
5581
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/variables`);
5582
+ const response = await fetch(url.toString(), {
5583
+ ...getFetchConfig(),
5584
+ method: "POST",
5585
+ body: JSON.stringify(options),
5586
+ });
5587
+ await handleGitLabError(response);
5588
+ const data = await response.json();
5589
+ return GitLabPipelineScheduleVariableSchema.parse(data);
5590
+ }
5591
+ /**
5592
+ * Update a variable of a pipeline schedule
5593
+ *
5594
+ * @param {string} projectId - The ID or URL-encoded path of the project
5595
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5596
+ * @param {string} key - The key of the variable to update
5597
+ * @param {UpdatePipelineScheduleVariableOptions} options - The new value and type
5598
+ * @returns {Promise<GitLabPipelineScheduleVariable>} The updated pipeline schedule variable
5599
+ */
5600
+ async function updatePipelineScheduleVariable(projectId, pipelineScheduleId, key, options) {
5601
+ projectId = decodeURIComponent(projectId); // Decode project ID
5602
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/variables/${encodeGitLabPathSegment(key)}`);
5603
+ const response = await fetch(url.toString(), {
5604
+ ...getFetchConfig(),
5605
+ method: "PUT",
5606
+ body: JSON.stringify(options),
5607
+ });
5608
+ await handleGitLabError(response);
5609
+ const data = await response.json();
5610
+ return GitLabPipelineScheduleVariableSchema.parse(data);
5611
+ }
5612
+ /**
5613
+ * Delete a variable from a pipeline schedule
5614
+ *
5615
+ * @param {string} projectId - The ID or URL-encoded path of the project
5616
+ * @param {number|string} pipelineScheduleId - The ID of the pipeline schedule
5617
+ * @param {string} key - The key of the variable to delete
5618
+ * @returns {Promise<void>}
5619
+ */
5620
+ async function deletePipelineScheduleVariable(projectId, pipelineScheduleId, key) {
5621
+ projectId = decodeURIComponent(projectId); // Decode project ID
5622
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/pipeline_schedules/${encodeGitLabPathSegment(pipelineScheduleId)}/variables/${encodeGitLabPathSegment(key)}`);
5623
+ const response = await fetch(url.toString(), {
5624
+ ...getFetchConfig(),
5625
+ method: "DELETE",
5626
+ });
5627
+ await handleGitLabError(response);
5628
+ }
5377
5629
  /**
5378
5630
  * Run a manual job
5379
5631
  *
@@ -8602,6 +8854,136 @@ async function handleToolCall(params) {
8602
8854
  ],
8603
8855
  };
8604
8856
  }
8857
+ case "list_pipeline_schedules": {
8858
+ const args = ListPipelineSchedulesSchema.parse(params.arguments);
8859
+ const { project_id, ...options } = args;
8860
+ const schedules = await listPipelineSchedules(project_id, options);
8861
+ return {
8862
+ content: [{ type: "text", text: JSON.stringify(schedules, null, 2) }],
8863
+ };
8864
+ }
8865
+ case "get_pipeline_schedule": {
8866
+ const { project_id, pipeline_schedule_id } = GetPipelineScheduleSchema.parse(params.arguments);
8867
+ const schedule = await getPipelineSchedule(project_id, pipeline_schedule_id);
8868
+ return {
8869
+ content: [{ type: "text", text: JSON.stringify(schedule, null, 2) }],
8870
+ };
8871
+ }
8872
+ case "list_pipeline_schedule_pipelines": {
8873
+ const args = ListPipelineSchedulePipelinesSchema.parse(params.arguments);
8874
+ const { project_id, pipeline_schedule_id, ...options } = args;
8875
+ const pipelines = await listPipelineSchedulePipelines(project_id, pipeline_schedule_id, options);
8876
+ return {
8877
+ content: [{ type: "text", text: JSON.stringify(pipelines, null, 2) }],
8878
+ };
8879
+ }
8880
+ case "create_pipeline_schedule": {
8881
+ const args = CreatePipelineScheduleSchema.parse(params.arguments);
8882
+ const { project_id, ...options } = args;
8883
+ const schedule = await createPipelineSchedule(project_id, options);
8884
+ return {
8885
+ content: [
8886
+ {
8887
+ type: "text",
8888
+ text: `Created pipeline schedule #${schedule.id} "${schedule.description}" on ${schedule.ref} (cron: ${schedule.cron} ${schedule.cron_timezone ?? "UTC"}). Active: ${schedule.active}\nNext run: ${schedule.next_run_at ?? "not scheduled"}`,
8889
+ },
8890
+ ],
8891
+ };
8892
+ }
8893
+ case "update_pipeline_schedule": {
8894
+ const args = UpdatePipelineScheduleSchema.parse(params.arguments);
8895
+ const { project_id, pipeline_schedule_id, ...options } = args;
8896
+ const schedule = await updatePipelineSchedule(project_id, pipeline_schedule_id, options);
8897
+ return {
8898
+ content: [
8899
+ {
8900
+ type: "text",
8901
+ text: `Updated pipeline schedule #${schedule.id} "${schedule.description}" on ${schedule.ref} (cron: ${schedule.cron} ${schedule.cron_timezone ?? "UTC"}). Active: ${schedule.active}\nNext run: ${schedule.next_run_at ?? "not scheduled"}`,
8902
+ },
8903
+ ],
8904
+ };
8905
+ }
8906
+ case "delete_pipeline_schedule": {
8907
+ const { project_id, pipeline_schedule_id } = DeletePipelineScheduleSchema.parse(params.arguments);
8908
+ await deletePipelineSchedule(project_id, pipeline_schedule_id);
8909
+ return {
8910
+ content: [
8911
+ {
8912
+ type: "text",
8913
+ text: `Deleted pipeline schedule #${pipeline_schedule_id}`,
8914
+ },
8915
+ ],
8916
+ };
8917
+ }
8918
+ case "play_pipeline_schedule": {
8919
+ const { project_id, pipeline_schedule_id } = PlayPipelineScheduleSchema.parse(params.arguments);
8920
+ const result = await playPipelineSchedule(project_id, pipeline_schedule_id);
8921
+ return {
8922
+ content: [
8923
+ {
8924
+ type: "text",
8925
+ text: `Ran pipeline schedule #${pipeline_schedule_id} immediately; the next scheduled run is unchanged. GitLab responded: ${result.message ?? "accepted"}`,
8926
+ },
8927
+ ],
8928
+ };
8929
+ }
8930
+ case "take_ownership_pipeline_schedule": {
8931
+ const { project_id, pipeline_schedule_id } = TakeOwnershipPipelineScheduleSchema.parse(params.arguments);
8932
+ const schedule = await takeOwnershipPipelineSchedule(project_id, pipeline_schedule_id);
8933
+ return {
8934
+ content: [
8935
+ {
8936
+ type: "text",
8937
+ text: `Took ownership of pipeline schedule #${schedule.id} "${schedule.description}". Owner: ${schedule.owner?.username ?? "unknown"}`,
8938
+ },
8939
+ ],
8940
+ };
8941
+ }
8942
+ case "get_pipeline_schedule_variable": {
8943
+ const { project_id, pipeline_schedule_id, key } = GetPipelineScheduleVariableSchema.parse(params.arguments);
8944
+ const variable = await getPipelineScheduleVariable(project_id, pipeline_schedule_id, key);
8945
+ return {
8946
+ content: [{ type: "text", text: JSON.stringify(variable, null, 2) }],
8947
+ };
8948
+ }
8949
+ case "create_pipeline_schedule_variable": {
8950
+ const args = CreatePipelineScheduleVariableSchema.parse(params.arguments);
8951
+ const { project_id, pipeline_schedule_id, ...options } = args;
8952
+ const variable = await createPipelineScheduleVariable(project_id, pipeline_schedule_id, options);
8953
+ return {
8954
+ content: [
8955
+ {
8956
+ type: "text",
8957
+ text: `Created variable '${variable.key}' on pipeline schedule #${pipeline_schedule_id}`,
8958
+ },
8959
+ ],
8960
+ };
8961
+ }
8962
+ case "update_pipeline_schedule_variable": {
8963
+ const args = UpdatePipelineScheduleVariableSchema.parse(params.arguments);
8964
+ const { project_id, pipeline_schedule_id, key, ...options } = args;
8965
+ const variable = await updatePipelineScheduleVariable(project_id, pipeline_schedule_id, key, options);
8966
+ return {
8967
+ content: [
8968
+ {
8969
+ type: "text",
8970
+ text: `Updated variable '${variable.key}' on pipeline schedule #${pipeline_schedule_id}`,
8971
+ },
8972
+ ],
8973
+ };
8974
+ }
8975
+ case "delete_pipeline_schedule_variable": {
8976
+ const { project_id, pipeline_schedule_id, key } = DeletePipelineScheduleVariableSchema.parse(params.arguments);
8977
+ await deletePipelineScheduleVariable(project_id, pipeline_schedule_id, key);
8978
+ return {
8979
+ content: [
8980
+ {
8981
+ type: "text",
8982
+ text: `Deleted variable '${key}' from pipeline schedule #${pipeline_schedule_id}`,
8983
+ },
8984
+ ],
8985
+ };
8986
+ }
8605
8987
  case "play_pipeline_job": {
8606
8988
  const { project_id, job_id, job_variables_attributes } = PlayPipelineJobSchema.parse(params.arguments);
8607
8989
  const job = await playPipelineJob(project_id, job_id, job_variables_attributes);
@@ -8691,6 +9073,14 @@ async function handleToolCall(params) {
8691
9073
  content: [{ type: "text", text: JSON.stringify(mergeRequests) }],
8692
9074
  };
8693
9075
  }
9076
+ case "list_group_merge_requests": {
9077
+ const { group_id, ...options } = ListGroupMergeRequestsSchema.parse(params.arguments);
9078
+ const cleanedOptions = cleanMutuallyExclusiveIdUsernameOptions(options, LIST_MERGE_REQUESTS_ID_USERNAME_PAIRS);
9079
+ const mergeRequests = await listGroupMergeRequests(group_id, cleanedOptions);
9080
+ return {
9081
+ content: [{ type: "text", text: JSON.stringify(mergeRequests) }],
9082
+ };
9083
+ }
8694
9084
  case "list_milestones": {
8695
9085
  const { project_id, ...options } = ListProjectMilestonesSchema.parse(params.arguments);
8696
9086
  const milestones = await listProjectMilestones(project_id, options);