@zereight/mcp-gitlab 2.3.15-next.178 → 2.3.15-next.180

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
@@ -143,7 +143,7 @@ CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMerg
143
143
  GitLabDiscussionNoteSchema, // Added
144
144
  GitLabDiscussionSchema,
145
145
  // Draft Notes Schemas
146
- GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, 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, GetGroupIterationSchema, UpdateGroupIterationSchema, 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
146
+ GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, 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, GetGroupIterationSchema, UpdateGroupIterationSchema, CreateGroupIterationSchema, GroupIterationCadence, ListGroupIterationCadencesSchema, DeleteGroupIterationSchema, ListProjectIterationsSchema, CreateGroupIterationCadenceSchema, UpdateGroupIterationCadenceSchema, DeleteGroupIterationCadenceSchema, 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
147
147
  GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListProjectRunnersSchema, GetRunnerSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectMilestonesSchema, ListGroupMilestonesSchema, ListProjectsSchema, ListWikiPagesSchema, GetGroupWikiPageSchema, ListGroupWikiPagesSchema, UpdateGroupWikiPageSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, 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, ListProtectedTagsSchema, GetProtectedTagSchema, ProtectTagSchema, UnprotectTagSchema, GitLabTagSchema, GitLabTagSignatureSchema, ListSnippetsSchema, GetSnippetSchema, CreateSnippetSchema, UpdateSnippetSchema, DeleteSnippetSchema, GitLabSnippetSchema, GetMergeRequestNotesSchema, GetMergeRequestNoteSchema, GetMergeRequestDiscussionSchema, DeleteMergeRequestDiscussionNoteSchema, ResolveMergeRequestThreadSchema, GetWorkItemSchema, ListWorkItemsSchema, CreateWorkItemSchema, UpdateWorkItemSchema, ConvertWorkItemTypeSchema, ListWorkItemStatusesSchema, ListWorkItemNotesSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, MoveWorkItemSchema, ListCustomFieldDefinitionsSchema, GetTimelineEventsSchema, CreateTimelineEventSchema, ListWebhooksSchema, CreateWebhookSchema, UpdateWebhookSchema, DeleteWebhookSchema, ListWebhookEventsSchema, GetWebhookEventSchema, HealthCheckSchema, } from "./schemas.js";
148
148
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
149
149
  import { createLogger, flushBufferedLogs, flushStartupLogs } from "./utils/logger.js";
@@ -536,6 +536,7 @@ function createServer() {
536
536
  error instanceof ProjectAccessDeniedError;
537
537
  const safeError = logError(error);
538
538
  if (isRecoverableToolError) {
539
+ const meta = safeError instanceof GitLabApiError ? gitLabApiErrorMetadata(safeError) : undefined;
539
540
  return {
540
541
  content: [
541
542
  {
@@ -544,6 +545,7 @@ function createServer() {
544
545
  },
545
546
  ],
546
547
  isError: true,
548
+ ...(meta ? { _meta: { "io.github.zereight.gitlab-mcp/http-error": meta } } : {}),
547
549
  };
548
550
  }
549
551
  throw safeError;
@@ -1292,10 +1294,41 @@ if (!isCliInvocation(process.argv) &&
1292
1294
  exitAfterFlush(1);
1293
1295
  }
1294
1296
  class GitLabApiError extends Error {
1295
- constructor(message) {
1297
+ /** HTTP status of the GitLab response this error describes, when there was one. */
1298
+ status;
1299
+ /** GitLab's Retry-After delay in seconds, forwarded unchanged when present. */
1300
+ retryAfter;
1301
+ /**
1302
+ * @param message - The error text shown in the tool result.
1303
+ * @param response - The GitLab response the error describes; supplies status
1304
+ * and Retry-After when given.
1305
+ */
1306
+ constructor(message, response) {
1296
1307
  super(message);
1297
1308
  this.name = "GitLabApiError";
1309
+ if (response) {
1310
+ this.status = response.status;
1311
+ this.retryAfter = response.headers.get("retry-after") ?? undefined;
1312
+ }
1313
+ }
1314
+ }
1315
+ /**
1316
+ * Out-of-band HTTP metadata for an error result. Keep it separate from
1317
+ * structuredContent so clients preserve the error text and do not validate
1318
+ * this metadata against a tool's output schema.
1319
+ */
1320
+ function gitLabApiErrorMetadata(error) {
1321
+ if (error.status === undefined && error.retryAfter === undefined) {
1322
+ return undefined;
1298
1323
  }
1324
+ const meta = {};
1325
+ if (error.status !== undefined) {
1326
+ meta.status = error.status;
1327
+ }
1328
+ if (error.retryAfter !== undefined) {
1329
+ meta.retryAfter = error.retryAfter;
1330
+ }
1331
+ return meta;
1299
1332
  }
1300
1333
  class ToolInputError extends Error {
1301
1334
  constructor(message) {
@@ -1326,12 +1359,12 @@ async function handleGitLabError(response) {
1326
1359
  // before the common tool-call boundary returns/logs it.
1327
1360
  logger.error("GitLab API Rate Limit Exceeded");
1328
1361
  logger.error("User API Key Rate limit exceeded. Please try again later.");
1329
- const error = new GitLabApiError(appendRecoveryHint(`GitLab API Rate Limit Exceeded: ${errorBody}`));
1362
+ const error = new GitLabApiError(appendRecoveryHint(`GitLab API Rate Limit Exceeded: ${errorBody}`), response);
1330
1363
  throw error;
1331
1364
  }
1332
1365
  else {
1333
1366
  // Handle other API errors
1334
- const error = new GitLabApiError(appendRecoveryHint(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`));
1367
+ const error = new GitLabApiError(appendRecoveryHint(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`), response);
1335
1368
  throw error;
1336
1369
  }
1337
1370
  }
@@ -1358,7 +1391,7 @@ async function throwUserApiScopeErrorUnlessRateLimitedAsync(response) {
1358
1391
  if (isGitLabUserApiRateLimitBody(errorBody) || !isGitLabInsufficientUserScopeBody(errorBody)) {
1359
1392
  return;
1360
1393
  }
1361
- throw new GitLabApiError(USER_API_INSUFFICIENT_SCOPE_MESSAGE);
1394
+ throw new GitLabApiError(USER_API_INSUFFICIENT_SCOPE_MESSAGE, response);
1362
1395
  }
1363
1396
  async function authenticateWithJobTokenFallbackAsync(response) {
1364
1397
  if (response.ok ||
@@ -1430,7 +1463,7 @@ async function forkProject(projectId, namespace) {
1430
1463
  });
1431
1464
  // Handle case where project already exists
1432
1465
  if (response.status === 409) {
1433
- throw new GitLabApiError("Project already exists in the target namespace");
1466
+ throw new GitLabApiError("Project already exists in the target namespace", response);
1434
1467
  }
1435
1468
  await handleGitLabError(response);
1436
1469
  const data = await response.json();
@@ -1501,7 +1534,7 @@ async function getFileContents(projectId, filePath, ref) {
1501
1534
  });
1502
1535
  // Handle file not found
1503
1536
  if (response.status === 404) {
1504
- throw new GitLabApiError(`File not found: ${filePath}`);
1537
+ throw new GitLabApiError(`File not found: ${filePath}`, response);
1505
1538
  }
1506
1539
  await handleGitLabError(response);
1507
1540
  const data = await response.json();
@@ -1534,7 +1567,7 @@ async function createIssue(projectId, options) {
1534
1567
  // Handle bad request
1535
1568
  if (response.status === 400) {
1536
1569
  const errorBody = await response.text();
1537
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
1570
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
1538
1571
  }
1539
1572
  await handleGitLabError(response);
1540
1573
  const data = await response.json();
@@ -1770,7 +1803,7 @@ async function executeGraphQL(query, variables = {}) {
1770
1803
  });
1771
1804
  if (!response.ok) {
1772
1805
  const errorBody = await response.text();
1773
- throw new GitLabApiError(`GraphQL request failed (${response.status}): ${errorBody}`);
1806
+ throw new GitLabApiError(`GraphQL request failed (${response.status}): ${errorBody}`, response);
1774
1807
  }
1775
1808
  const json = await response.json();
1776
1809
  if (json.errors && json.errors.length > 0) {
@@ -3270,11 +3303,11 @@ async function createMergeRequest(projectId, options) {
3270
3303
  });
3271
3304
  if (response.status === 400) {
3272
3305
  const errorBody = await response.text();
3273
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3306
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3274
3307
  }
3275
3308
  if (!response.ok) {
3276
3309
  const errorBody = await response.text();
3277
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3310
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3278
3311
  }
3279
3312
  const data = await response.json();
3280
3313
  return GitLabMergeRequestSchema.parse(data);
@@ -3362,7 +3395,7 @@ async function deleteMergeRequestDiscussionNote(projectId, mergeRequestIid, disc
3362
3395
  });
3363
3396
  if (!response.ok) {
3364
3397
  const errorText = await response.text();
3365
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
3398
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
3366
3399
  }
3367
3400
  }
3368
3401
  /**
@@ -3524,7 +3557,7 @@ async function deleteMergeRequestNote(projectId, mergeRequestIid, noteId) {
3524
3557
  });
3525
3558
  if (!response.ok) {
3526
3559
  const errorText = await response.text();
3527
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
3560
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
3528
3561
  }
3529
3562
  }
3530
3563
  // --- Emoji Reactions (REST) ---
@@ -3695,7 +3728,7 @@ async function createOrUpdateFile(projectId, filePath, content, commitMessage, b
3695
3728
  });
3696
3729
  if (!response.ok) {
3697
3730
  const errorBody = await response.text();
3698
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3731
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3699
3732
  }
3700
3733
  const data = await response.json();
3701
3734
  return GitLabCreateUpdateFileResponseSchema.parse(data);
@@ -3724,11 +3757,11 @@ async function createCommit(projectId, message, branch, actions) {
3724
3757
  });
3725
3758
  if (response.status === 400) {
3726
3759
  const errorBody = await response.text();
3727
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3760
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3728
3761
  }
3729
3762
  if (!response.ok) {
3730
3763
  const errorBody = await response.text();
3731
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3764
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3732
3765
  }
3733
3766
  const data = await response.json();
3734
3767
  return GitLabCommitSchema.parse(data);
@@ -3754,7 +3787,7 @@ async function searchProjects(query, page = 1, perPage = 20) {
3754
3787
  });
3755
3788
  if (!response.ok) {
3756
3789
  const errorBody = await response.text();
3757
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3790
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3758
3791
  }
3759
3792
  const unfiltered = (await response.json());
3760
3793
  const projects = filterProjectsByAllowlist(unfiltered);
@@ -3841,7 +3874,7 @@ async function createRepository(options) {
3841
3874
  });
3842
3875
  if (!response.ok) {
3843
3876
  const errorBody = await response.text();
3844
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3877
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3845
3878
  }
3846
3879
  const data = await response.json();
3847
3880
  return GitLabRepositorySchema.parse(data);
@@ -4215,7 +4248,7 @@ async function getBranchDiffs(projectId, from, to, straight) {
4215
4248
  });
4216
4249
  if (!response.ok) {
4217
4250
  const errorBody = await response.text();
4218
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
4251
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
4219
4252
  }
4220
4253
  const data = await response.json();
4221
4254
  return GitLabCompareResultSchema.parse(data);
@@ -4456,7 +4489,7 @@ noteableIid, body) {
4456
4489
  });
4457
4490
  if (!response.ok) {
4458
4491
  const errorText = await response.text();
4459
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4492
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4460
4493
  }
4461
4494
  return await response.json();
4462
4495
  }
@@ -4471,7 +4504,7 @@ async function getDraftNote(project_id, merge_request_iid, draft_note_id) {
4471
4504
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/merge_requests/${encodeGitLabPathSegment(merge_request_iid)}/draft_notes/${encodeGitLabPathSegment(draft_note_id)}`, { ...getFetchConfig() });
4472
4505
  if (!response.ok) {
4473
4506
  const errorText = await response.text();
4474
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4507
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4475
4508
  }
4476
4509
  const data = await response.json();
4477
4510
  return GitLabDraftNoteSchema.parse(data);
@@ -4485,7 +4518,7 @@ async function listDraftNotes(projectId, mergeRequestIid) {
4485
4518
  });
4486
4519
  if (!response.ok) {
4487
4520
  const errorText = await response.text();
4488
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4521
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4489
4522
  }
4490
4523
  const data = await response.json();
4491
4524
  return z.array(GitLabDraftNoteSchema).parse(data);
@@ -4520,7 +4553,7 @@ async function createDraftNote(projectId, mergeRequestIid, body, inReplyToDiscus
4520
4553
  });
4521
4554
  if (!response.ok) {
4522
4555
  const errorText = await response.text();
4523
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4556
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4524
4557
  }
4525
4558
  const data = await response.json();
4526
4559
  return GitLabDraftNoteSchema.parse(data);
@@ -4555,7 +4588,7 @@ async function updateDraftNote(projectId, mergeRequestIid, draftNoteId, body, po
4555
4588
  });
4556
4589
  if (!response.ok) {
4557
4590
  const errorText = await response.text();
4558
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4591
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4559
4592
  }
4560
4593
  const data = await response.json();
4561
4594
  return GitLabDraftNoteSchema.parse(data);
@@ -4576,7 +4609,7 @@ async function deleteDraftNote(projectId, mergeRequestIid, draftNoteId) {
4576
4609
  });
4577
4610
  if (!response.ok) {
4578
4611
  const errorText = await response.text();
4579
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4612
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4580
4613
  }
4581
4614
  }
4582
4615
  /**
@@ -4595,7 +4628,7 @@ async function publishDraftNote(projectId, mergeRequestIid, draftNoteId) {
4595
4628
  });
4596
4629
  if (!response.ok) {
4597
4630
  const errorText = await response.text();
4598
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4631
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4599
4632
  }
4600
4633
  // Handle empty response (204 No Content) or successful response
4601
4634
  const responseText = await response.text();
@@ -4698,7 +4731,7 @@ async function bulkPublishDraftNotes(projectId, mergeRequestIid, options = {}) {
4698
4731
  });
4699
4732
  if (!response.ok) {
4700
4733
  const errorText = await response.text();
4701
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4734
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4702
4735
  }
4703
4736
  // Handle empty response (204 No Content) or successful response
4704
4737
  const responseText = await response.text();
@@ -4729,7 +4762,7 @@ async function resolveMergeRequestThread(projectId, mergeRequestIid, discussionI
4729
4762
  });
4730
4763
  if (!response.ok) {
4731
4764
  const errorText = await response.text();
4732
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4765
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4733
4766
  }
4734
4767
  }
4735
4768
  /**
@@ -5321,7 +5354,7 @@ async function getPipeline(projectId, pipelineId, signal) {
5321
5354
  signal,
5322
5355
  });
5323
5356
  if (response.status === 404) {
5324
- throw new GitLabApiError(`Pipeline not found`);
5357
+ throw new GitLabApiError(`Pipeline not found`, response);
5325
5358
  }
5326
5359
  await handleGitLabError(response);
5327
5360
  const data = await response.json();
@@ -5394,7 +5427,7 @@ async function getDeployment(projectId, deploymentId) {
5394
5427
  ...getFetchConfig(),
5395
5428
  });
5396
5429
  if (response.status === 404) {
5397
- throw new GitLabApiError(`Deployment not found`);
5430
+ throw new GitLabApiError(`Deployment not found`, response);
5398
5431
  }
5399
5432
  await handleGitLabError(response);
5400
5433
  const data = await response.json();
@@ -5447,7 +5480,7 @@ async function getEnvironment(projectId, environmentId) {
5447
5480
  ...getFetchConfig(),
5448
5481
  });
5449
5482
  if (response.status === 404) {
5450
- throw new GitLabApiError(`Environment not found`);
5483
+ throw new GitLabApiError(`Environment not found`, response);
5451
5484
  }
5452
5485
  await handleGitLabError(response);
5453
5486
  const data = await response.json();
@@ -5570,7 +5603,7 @@ async function getRunner(runnerId, projectId) {
5570
5603
  ...getFetchConfig(),
5571
5604
  });
5572
5605
  if (response.status === 404) {
5573
- throw new GitLabApiError("Runner not found");
5606
+ throw new GitLabApiError("Runner not found", response);
5574
5607
  }
5575
5608
  await handleGitLabError(response);
5576
5609
  const details = redactSensitiveGitLabFields(await response.json());
@@ -5634,7 +5667,7 @@ async function listPipelineJobs(projectId, pipelineId, options = {}) {
5634
5667
  ...getFetchConfig(),
5635
5668
  });
5636
5669
  if (response.status === 404) {
5637
- throw new GitLabApiError(`Pipeline not found`);
5670
+ throw new GitLabApiError(`Pipeline not found`, response);
5638
5671
  }
5639
5672
  await handleGitLabError(response);
5640
5673
  const data = await response.json();
@@ -5657,7 +5690,7 @@ async function listPipelineTriggerJobs(projectId, pipelineId, options = {}) {
5657
5690
  ...getFetchConfig(),
5658
5691
  });
5659
5692
  if (response.status === 404) {
5660
- throw new GitLabApiError(`Pipeline not found`);
5693
+ throw new GitLabApiError(`Pipeline not found`, response);
5661
5694
  }
5662
5695
  await handleGitLabError(response);
5663
5696
  const data = await response.json();
@@ -5671,7 +5704,7 @@ async function getPipelineJob(projectId, jobId, signal) {
5671
5704
  signal,
5672
5705
  });
5673
5706
  if (response.status === 404) {
5674
- throw new GitLabApiError(`Job not found`);
5707
+ throw new GitLabApiError(`Job not found`, response);
5675
5708
  }
5676
5709
  await handleGitLabError(response);
5677
5710
  const data = await response.json();
@@ -5695,7 +5728,7 @@ async function getPipelineJobOutput(projectId, jobId, query = {}) {
5695
5728
  },
5696
5729
  });
5697
5730
  if (response.status === 404) {
5698
- throw new GitLabApiError(`Job trace not found or job is not finished yet`);
5731
+ throw new GitLabApiError(`Job trace not found or job is not finished yet`, response);
5699
5732
  }
5700
5733
  await handleGitLabError(response);
5701
5734
  const pattern = query.pattern;
@@ -5784,7 +5817,7 @@ async function listJobArtifacts(projectId, jobId, options = {}) {
5784
5817
  ...getFetchConfig(),
5785
5818
  });
5786
5819
  if (response.status === 404) {
5787
- throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`);
5820
+ throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`, response);
5788
5821
  }
5789
5822
  await handleGitLabError(response);
5790
5823
  const data = await response.json();
@@ -5804,7 +5837,7 @@ async function downloadJobArtifacts(projectId, jobId, localPath) {
5804
5837
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts`);
5805
5838
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5806
5839
  if (response.status === 404) {
5807
- throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`);
5840
+ throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`, response);
5808
5841
  }
5809
5842
  await handleGitLabError(response);
5810
5843
  const filename = `artifacts_job_${encodeGitLabPathSegment(jobId)}.zip`;
@@ -5838,7 +5871,7 @@ async function getJobArtifactFile(projectId, jobId, artifactPath) {
5838
5871
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts/${encodedArtifactPath}`);
5839
5872
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5840
5873
  if (response.status === 404) {
5841
- throw new GitLabApiError(`Artifact file not found: ${artifactPath}`);
5874
+ throw new GitLabApiError(`Artifact file not found: ${artifactPath}`, response);
5842
5875
  }
5843
5876
  await handleGitLabError(response);
5844
5877
  return await response.text();
@@ -6314,10 +6347,10 @@ async function getRepositoryTree(options) {
6314
6347
  queryParams.append("pagination", options.pagination);
6315
6348
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(options.project_id))}/repository/tree?${queryParams.toString()}`, { ...getFetchConfig() });
6316
6349
  if (response.status === 404) {
6317
- throw new GitLabApiError("Repository or path not found");
6350
+ throw new GitLabApiError("Repository or path not found", response);
6318
6351
  }
6319
6352
  if (!response.ok) {
6320
- throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`);
6353
+ throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`, response);
6321
6354
  }
6322
6355
  const data = await response.json();
6323
6356
  const items = z.array(GitLabTreeItemSchema).parse(data);
@@ -6981,6 +7014,18 @@ async function listGroupMembers(groupId, options = {}) {
6981
7014
  async function listGroupIterations(groupId, options = {}) {
6982
7015
  groupId = decodeURIComponent(groupId);
6983
7016
  const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/iterations`);
7017
+ return fetchIterations(url, options);
7018
+ }
7019
+ /**
7020
+ * list project iterations (REST GET /projects/:id/iterations): the project's group
7021
+ * iterations, with the same filters as the group endpoint.
7022
+ */
7023
+ async function listProjectIterations(projectId, options = {}) {
7024
+ projectId = decodeURIComponent(projectId);
7025
+ const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/iterations`);
7026
+ return fetchIterations(url, options);
7027
+ }
7028
+ async function fetchIterations(url, options) {
6984
7029
  // クエリパラメータの追加
6985
7030
  if (options.state)
6986
7031
  url.searchParams.append("state", options.state);
@@ -7045,7 +7090,8 @@ async function getGroupIteration(groupId, iterationId) {
7045
7090
  iidMatch = iteration;
7046
7091
  }
7047
7092
  }
7048
- if (iterations.length < 100)
7093
+ // A GID matches only the primary id, so later pages cannot change the result.
7094
+ if (iterations.length < 100 || (isGraphqlGid && idMatch))
7049
7095
  break;
7050
7096
  }
7051
7097
  if (isGraphqlGid) {
@@ -7063,10 +7109,8 @@ async function updateGroupIteration(groupId, iterationId, options) {
7063
7109
  throw new ToolInputError("Provide at least one iteration field to update");
7064
7110
  }
7065
7111
  const current = await getGroupIteration(groupId, iterationId);
7066
- const groupReference = /^group:/i.test(groupId) ? groupId : `group:${groupId}`;
7067
- const { path: groupPath } = await resolveProjectOrGroupPath(groupReference);
7068
7112
  const input = {
7069
- groupPath,
7113
+ groupPath: await resolveGroupPath(groupId),
7070
7114
  id: `${ITERATION_GID_PREFIX}${current.id}`,
7071
7115
  };
7072
7116
  if (options.title !== undefined)
@@ -7095,6 +7139,227 @@ async function updateGroupIteration(groupId, iterationId, options) {
7095
7139
  }
7096
7140
  return getGroupIteration(groupId, `${ITERATION_GID_PREFIX}${current.id}`);
7097
7141
  }
7142
+ const ITERATION_CADENCE_GID_PREFIX = "gid://gitlab/Iterations::Cadence/";
7143
+ function normalizeIterationCadenceId(cadenceId) {
7144
+ const decoded = decodeURIComponent(cadenceId);
7145
+ return decoded.startsWith("gid://") ? decoded : `${ITERATION_CADENCE_GID_PREFIX}${decoded}`;
7146
+ }
7147
+ async function resolveGroupPath(groupId) {
7148
+ const groupReference = /^group:/i.test(groupId) ? groupId : `group:${groupId}`;
7149
+ const { path } = await resolveProjectOrGroupPath(groupReference);
7150
+ return path;
7151
+ }
7152
+ /**
7153
+ * Create a group iteration with GraphQL iterationCreate. Fields map one-to-one onto the
7154
+ * mutation input; GitLab validates them (for example, which cadence the iteration needs).
7155
+ */
7156
+ async function createGroupIteration(groupId, options) {
7157
+ const input = { groupPath: await resolveGroupPath(groupId) };
7158
+ if (options.title !== undefined)
7159
+ input.title = options.title;
7160
+ if (options.description !== undefined)
7161
+ input.description = options.description;
7162
+ if (options.start_date !== undefined)
7163
+ input.startDate = options.start_date;
7164
+ if (options.due_date !== undefined)
7165
+ input.dueDate = options.due_date;
7166
+ if (options.iterations_cadence_id !== undefined) {
7167
+ input.iterationsCadenceId = normalizeIterationCadenceId(options.iterations_cadence_id);
7168
+ }
7169
+ const mutation = `
7170
+ mutation CreateGroupIteration($input: iterationCreateInput!) {
7171
+ iterationCreate(input: $input) {
7172
+ iteration { id }
7173
+ errors
7174
+ }
7175
+ }
7176
+ `;
7177
+ const data = await executeGraphQL(mutation, { input });
7178
+ const result = data.iterationCreate;
7179
+ if (result.errors.length > 0) {
7180
+ throw new Error(`Failed to create group iteration: ${result.errors.join(", ")}`);
7181
+ }
7182
+ if (!result.iteration) {
7183
+ throw new Error("Failed to create group iteration: GitLab returned no iteration");
7184
+ }
7185
+ return getGroupIteration(groupId, result.iteration.id);
7186
+ }
7187
+ /** Delete a group iteration with GraphQL iterationDelete; it accepts an ID, IID, or GID. */
7188
+ async function deleteGroupIteration(groupId, iterationId) {
7189
+ const current = await getGroupIteration(groupId, iterationId);
7190
+ const mutation = `
7191
+ mutation DeleteGroupIteration($id: IterationID!) {
7192
+ iterationDelete(input: { id: $id }) {
7193
+ errors
7194
+ }
7195
+ }
7196
+ `;
7197
+ const data = await executeGraphQL(mutation, {
7198
+ id: `${ITERATION_GID_PREFIX}${current.id}`,
7199
+ });
7200
+ if (data.iterationDelete.errors.length > 0) {
7201
+ throw new Error(`Failed to delete group iteration: ${data.iterationDelete.errors.join(", ")}`);
7202
+ }
7203
+ }
7204
+ const ITERATION_CADENCE_FIELDS = `
7205
+ id title description automatic active startDate
7206
+ durationInWeeks iterationsInAdvance rollOver
7207
+ `;
7208
+ function toGroupIterationCadence(node) {
7209
+ return GroupIterationCadence.parse({
7210
+ id: node.id,
7211
+ title: node.title,
7212
+ description: node.description,
7213
+ automatic: node.automatic,
7214
+ active: node.active,
7215
+ start_date: node.startDate,
7216
+ duration_in_weeks: node.durationInWeeks,
7217
+ iterations_in_advance: node.iterationsInAdvance,
7218
+ roll_over: node.rollOver,
7219
+ });
7220
+ }
7221
+ /**
7222
+ * List a group's iteration cadences through GraphQL; GitLab has no REST endpoint for them.
7223
+ * Returned IDs are cadence GIDs, accepted as-is by the other iteration and cadence tools.
7224
+ */
7225
+ async function listGroupIterationCadences(groupId, options = {}) {
7226
+ const groupPath = await resolveGroupPath(groupId);
7227
+ const query = `
7228
+ query GroupIterationCadences(
7229
+ $fullPath: ID!
7230
+ $id: IterationsCadenceID
7231
+ $automatic: Boolean
7232
+ $active: Boolean
7233
+ $durationInWeeks: Int
7234
+ $title: String
7235
+ $includeAncestorGroups: Boolean
7236
+ $after: String
7237
+ ) {
7238
+ group(fullPath: $fullPath) {
7239
+ iterationCadences(
7240
+ id: $id
7241
+ automatic: $automatic
7242
+ active: $active
7243
+ durationInWeeks: $durationInWeeks
7244
+ title: $title
7245
+ includeAncestorGroups: $includeAncestorGroups
7246
+ first: 100
7247
+ after: $after
7248
+ ) {
7249
+ nodes { ${ITERATION_CADENCE_FIELDS} }
7250
+ pageInfo { hasNextPage endCursor }
7251
+ }
7252
+ }
7253
+ }
7254
+ `;
7255
+ const cadences = [];
7256
+ let after;
7257
+ do {
7258
+ const data = await executeGraphQL(query, {
7259
+ fullPath: groupPath,
7260
+ id: options.id !== undefined ? normalizeIterationCadenceId(options.id) : undefined,
7261
+ automatic: options.automatic,
7262
+ active: options.active,
7263
+ durationInWeeks: options.duration_in_weeks,
7264
+ title: options.title,
7265
+ includeAncestorGroups: options.include_ancestor_groups,
7266
+ after,
7267
+ });
7268
+ if (!data.group) {
7269
+ throw new Error(`Group ${groupPath} was not found`);
7270
+ }
7271
+ const { nodes, pageInfo } = data.group.iterationCadences;
7272
+ cadences.push(...nodes.map(toGroupIterationCadence));
7273
+ after = pageInfo.hasNextPage && pageInfo.endCursor ? pageInfo.endCursor : undefined;
7274
+ } while (after);
7275
+ return cadences;
7276
+ }
7277
+ /** Map the snake_case cadence fields onto the GraphQL cadence input, dropping unset ones. */
7278
+ function toIterationCadenceInput(options) {
7279
+ const input = {};
7280
+ if (options.title !== undefined)
7281
+ input.title = options.title;
7282
+ if (options.description !== undefined)
7283
+ input.description = options.description;
7284
+ if (options.automatic !== undefined)
7285
+ input.automatic = options.automatic;
7286
+ if (options.active !== undefined)
7287
+ input.active = options.active;
7288
+ if (options.duration_in_weeks !== undefined)
7289
+ input.durationInWeeks = options.duration_in_weeks;
7290
+ if (options.iterations_in_advance !== undefined) {
7291
+ input.iterationsInAdvance = options.iterations_in_advance;
7292
+ }
7293
+ if (options.start_date !== undefined)
7294
+ input.startDate = options.start_date;
7295
+ if (options.roll_over !== undefined)
7296
+ input.rollOver = options.roll_over;
7297
+ return input;
7298
+ }
7299
+ /** Create a group iteration cadence with GraphQL iterationCadenceCreate. */
7300
+ async function createGroupIterationCadence(groupId, options) {
7301
+ const input = {
7302
+ groupPath: await resolveGroupPath(groupId),
7303
+ ...toIterationCadenceInput(options),
7304
+ };
7305
+ const mutation = `
7306
+ mutation CreateGroupIterationCadence($input: IterationCadenceCreateInput!) {
7307
+ iterationCadenceCreate(input: $input) {
7308
+ iterationCadence { ${ITERATION_CADENCE_FIELDS} }
7309
+ errors
7310
+ }
7311
+ }
7312
+ `;
7313
+ const data = await executeGraphQL(mutation, { input });
7314
+ const result = data.iterationCadenceCreate;
7315
+ if (result.errors.length > 0) {
7316
+ throw new Error(`Failed to create iteration cadence: ${result.errors.join(", ")}`);
7317
+ }
7318
+ if (!result.iterationCadence) {
7319
+ throw new Error("Failed to create iteration cadence: GitLab returned no cadence");
7320
+ }
7321
+ return toGroupIterationCadence(result.iterationCadence);
7322
+ }
7323
+ /** Update an iteration cadence with GraphQL iterationCadenceUpdate. */
7324
+ async function updateGroupIterationCadence(cadenceId, options) {
7325
+ const fields = toIterationCadenceInput(options);
7326
+ if (Object.keys(fields).length === 0) {
7327
+ throw new ToolInputError("Provide at least one iteration cadence field to update");
7328
+ }
7329
+ const mutation = `
7330
+ mutation UpdateGroupIterationCadence($input: IterationCadenceUpdateInput!) {
7331
+ iterationCadenceUpdate(input: $input) {
7332
+ iterationCadence { ${ITERATION_CADENCE_FIELDS} }
7333
+ errors
7334
+ }
7335
+ }
7336
+ `;
7337
+ const data = await executeGraphQL(mutation, { input: { id: normalizeIterationCadenceId(cadenceId), ...fields } });
7338
+ const result = data.iterationCadenceUpdate;
7339
+ if (result.errors.length > 0) {
7340
+ throw new Error(`Failed to update iteration cadence: ${result.errors.join(", ")}`);
7341
+ }
7342
+ if (!result.iterationCadence) {
7343
+ throw new Error("Failed to update iteration cadence: GitLab returned no cadence");
7344
+ }
7345
+ return toGroupIterationCadence(result.iterationCadence);
7346
+ }
7347
+ /** Delete an iteration cadence with GraphQL iterationCadenceDestroy. */
7348
+ async function deleteGroupIterationCadence(cadenceId) {
7349
+ const mutation = `
7350
+ mutation DeleteGroupIterationCadence($id: IterationsCadenceID!) {
7351
+ iterationCadenceDestroy(input: { id: $id }) {
7352
+ errors
7353
+ }
7354
+ }
7355
+ `;
7356
+ const data = await executeGraphQL(mutation, {
7357
+ id: normalizeIterationCadenceId(cadenceId),
7358
+ });
7359
+ if (data.iterationCadenceDestroy.errors.length > 0) {
7360
+ throw new Error(`Failed to delete iteration cadence: ${data.iterationCadenceDestroy.errors.join(", ")}`);
7361
+ }
7362
+ }
7098
7363
  // --- CI/CD Variables ---
7099
7364
  async function listProjectVariables(projectId, options = {}) {
7100
7365
  projectId = decodeURIComponent(projectId);
@@ -8253,7 +8518,11 @@ async function handleToolCall(params) {
8253
8518
  throw new ToolInputError(error.message);
8254
8519
  }
8255
8520
  if (error instanceof GitLabApiRequestHttpError) {
8256
- throw new GitLabApiError(error.message);
8521
+ // Carry the HTTP fields (status, Retry-After) into the tool error result.
8522
+ const apiError = new GitLabApiError(error.message);
8523
+ apiError.status = error.status;
8524
+ apiError.retryAfter = error.retryAfter;
8525
+ throw apiError;
8257
8526
  }
8258
8527
  throw error;
8259
8528
  }
@@ -10579,6 +10848,73 @@ async function handleToolCall(params) {
10579
10848
  content: [{ type: "text", text: JSON.stringify(iteration) }],
10580
10849
  };
10581
10850
  }
10851
+ case "create_group_iteration": {
10852
+ rejectIfStrictProjectScope("create_group_iteration");
10853
+ const args = CreateGroupIterationSchema.parse(params.arguments);
10854
+ const { group_id, ...options } = args;
10855
+ const iteration = await createGroupIteration(group_id, options);
10856
+ return {
10857
+ content: [{ type: "text", text: JSON.stringify(iteration) }],
10858
+ };
10859
+ }
10860
+ case "list_group_iteration_cadences": {
10861
+ rejectIfStrictProjectScope("list_group_iteration_cadences");
10862
+ const args = ListGroupIterationCadencesSchema.parse(params.arguments);
10863
+ const { group_id, ...options } = args;
10864
+ const cadences = await listGroupIterationCadences(group_id, options);
10865
+ return {
10866
+ content: [{ type: "text", text: JSON.stringify(cadences) }],
10867
+ };
10868
+ }
10869
+ case "delete_group_iteration": {
10870
+ rejectIfStrictProjectScope("delete_group_iteration");
10871
+ const { group_id, iteration_id } = DeleteGroupIterationSchema.parse(params.arguments);
10872
+ await deleteGroupIteration(group_id, iteration_id);
10873
+ return {
10874
+ content: [
10875
+ {
10876
+ type: "text",
10877
+ text: JSON.stringify({ status: "success", message: "Group iteration deleted successfully" }, null, 2),
10878
+ },
10879
+ ],
10880
+ };
10881
+ }
10882
+ case "list_project_iterations": {
10883
+ const { project_id, ...options } = ListProjectIterationsSchema.parse(params.arguments);
10884
+ const iterations = await listProjectIterations(project_id, options);
10885
+ return {
10886
+ content: [{ type: "text", text: JSON.stringify(iterations) }],
10887
+ };
10888
+ }
10889
+ case "create_group_iteration_cadence": {
10890
+ rejectIfStrictProjectScope("create_group_iteration_cadence");
10891
+ const { group_id, ...options } = CreateGroupIterationCadenceSchema.parse(params.arguments);
10892
+ const cadence = await createGroupIterationCadence(group_id, options);
10893
+ return {
10894
+ content: [{ type: "text", text: JSON.stringify(cadence) }],
10895
+ };
10896
+ }
10897
+ case "update_group_iteration_cadence": {
10898
+ rejectIfStrictProjectScope("update_group_iteration_cadence");
10899
+ const { iteration_cadence_id, ...options } = UpdateGroupIterationCadenceSchema.parse(params.arguments);
10900
+ const cadence = await updateGroupIterationCadence(iteration_cadence_id, options);
10901
+ return {
10902
+ content: [{ type: "text", text: JSON.stringify(cadence) }],
10903
+ };
10904
+ }
10905
+ case "delete_group_iteration_cadence": {
10906
+ rejectIfStrictProjectScope("delete_group_iteration_cadence");
10907
+ const { iteration_cadence_id } = DeleteGroupIterationCadenceSchema.parse(params.arguments);
10908
+ await deleteGroupIterationCadence(iteration_cadence_id);
10909
+ return {
10910
+ content: [
10911
+ {
10912
+ type: "text",
10913
+ text: JSON.stringify({ status: "success", message: "Iteration cadence deleted successfully" }, null, 2),
10914
+ },
10915
+ ],
10916
+ };
10917
+ }
10582
10918
  // --- CI/CD Variables ---
10583
10919
  case "list_project_variables": {
10584
10920
  const args = ListProjectVariablesSchema.parse(params.arguments);
package/build/schemas.js CHANGED
@@ -3614,6 +3614,10 @@ export const ListGroupIterationsSchema = z
3614
3614
  const requiredIterationIdentifier = (description) => z
3615
3615
  .preprocess(value => (typeof value === "number" ? String(value) : value), z.string().min(1))
3616
3616
  .describe(description);
3617
+ /** Same as {@link requiredIterationIdentifier}, for an optional identifier. */
3618
+ const optionalIterationIdentifier = (description) => z
3619
+ .preprocess(value => (typeof value === "number" ? String(value) : value), z.string().min(1).optional())
3620
+ .describe(description);
3617
3621
  export const GetGroupIterationSchema = z.object({
3618
3622
  group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3619
3623
  iteration_id: requiredIterationIdentifier("Iteration ID, IID, or GraphQL GID"),
@@ -3630,6 +3634,84 @@ export const UpdateGroupIterationSchema = z.object({
3630
3634
  start_date: z.string().optional().describe("New start date in YYYY-MM-DD format"),
3631
3635
  due_date: z.string().optional().describe("New due date in YYYY-MM-DD format"),
3632
3636
  });
3637
+ export const CreateGroupIterationSchema = z.object({
3638
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3639
+ title: z.string().optional().describe("Iteration title"),
3640
+ description: z.string().optional().describe("Iteration description"),
3641
+ start_date: z.string().optional().describe("Start date in YYYY-MM-DD format"),
3642
+ due_date: z.string().optional().describe("Due date in YYYY-MM-DD format"),
3643
+ iterations_cadence_id: optionalIterationIdentifier("Iteration cadence ID or GraphQL GID (gid://gitlab/Iterations::Cadence/<id>) to assign the new iteration to. Use list_group_iteration_cadences to find it."),
3644
+ });
3645
+ export const DeleteGroupIterationSchema = z.object({
3646
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3647
+ iteration_id: requiredIterationIdentifier("Iteration ID, IID, or GraphQL GID"),
3648
+ });
3649
+ export const ListProjectIterationsSchema = ListGroupIterationsSchema.omit({
3650
+ group_id: true,
3651
+ }).extend({
3652
+ project_id: requiredIterationIdentifier("Project ID or URL-encoded path"),
3653
+ });
3654
+ export const GroupIterationCadence = z.object({
3655
+ id: z.string(),
3656
+ title: z.string(),
3657
+ description: z.string().optional().nullable(),
3658
+ automatic: z.boolean().optional().nullable(),
3659
+ active: z.boolean().optional().nullable(),
3660
+ start_date: z.string().optional().nullable(),
3661
+ duration_in_weeks: z.number().optional().nullable(),
3662
+ iterations_in_advance: z.number().optional().nullable(),
3663
+ roll_over: z.boolean().optional().nullable(),
3664
+ });
3665
+ export const ListGroupIterationCadencesSchema = z.object({
3666
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3667
+ id: optionalIterationIdentifier("Return only the cadence with this ID or GraphQL GID (gid://gitlab/Iterations::Cadence/<id>)."),
3668
+ automatic: flexibleBooleanOptional.describe("Return only cadences that do (true) or do not (false) generate upcoming iterations automatically."),
3669
+ active: flexibleBooleanOptional.describe("Return only active (true) or inactive (false) cadences."),
3670
+ duration_in_weeks: z.coerce
3671
+ .number()
3672
+ .int()
3673
+ .optional()
3674
+ .describe("Return only cadences whose iterations last this many weeks."),
3675
+ title: z.string().optional().describe("Fuzzy search by cadence title."),
3676
+ include_ancestor_groups: flexibleBooleanOptional.describe("Include cadences from the group's ancestor groups."),
3677
+ });
3678
+ const iterationCadenceFields = {
3679
+ title: z.string().optional().describe("Cadence title"),
3680
+ description: z
3681
+ .string()
3682
+ .optional()
3683
+ .describe("Cadence description. Maximum length is 5000 characters."),
3684
+ duration_in_weeks: z.coerce
3685
+ .number()
3686
+ .int()
3687
+ .optional()
3688
+ .describe("Duration in weeks of the iterations within the cadence"),
3689
+ iterations_in_advance: z.coerce
3690
+ .number()
3691
+ .int()
3692
+ .optional()
3693
+ .describe("Number of future iterations to schedule in addition to the current one"),
3694
+ start_date: z
3695
+ .string()
3696
+ .optional()
3697
+ .describe("Automation start date, as a date (YYYY-MM-DD) or ISO 8601 timestamp"),
3698
+ roll_over: flexibleBooleanOptional.describe("Whether unfinished issues roll over to the next iteration"),
3699
+ };
3700
+ export const CreateGroupIterationCadenceSchema = z.object({
3701
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3702
+ automatic: coerceBooleanString.describe("Whether the cadence generates upcoming iterations automatically"),
3703
+ active: coerceBooleanString.describe("Whether the cadence is active"),
3704
+ ...iterationCadenceFields,
3705
+ });
3706
+ export const UpdateGroupIterationCadenceSchema = z.object({
3707
+ iteration_cadence_id: requiredIterationIdentifier("Iteration cadence ID or GraphQL GID (gid://gitlab/Iterations::Cadence/<id>)"),
3708
+ automatic: flexibleBooleanOptional.describe("Whether the cadence generates upcoming iterations automatically"),
3709
+ active: flexibleBooleanOptional.describe("Whether the cadence is active"),
3710
+ ...iterationCadenceFields,
3711
+ });
3712
+ export const DeleteGroupIterationCadenceSchema = z.object({
3713
+ iteration_cadence_id: requiredIterationIdentifier("Iteration cadence ID or GraphQL GID (gid://gitlab/Iterations::Cadence/<id>)"),
3714
+ });
3633
3715
  // Events API schemas
3634
3716
  export const GitLabEventAuthorSchema = z.object({
3635
3717
  id: z.coerce.string(),
@@ -34,9 +34,22 @@ export class GitLabApiRequestInputError extends Error {
34
34
  }
35
35
  }
36
36
  export class GitLabApiRequestHttpError extends Error {
37
- constructor(message) {
37
+ /** HTTP status of the GitLab response, when the error came from one. */
38
+ status;
39
+ /** GitLab's Retry-After delay in seconds, forwarded unchanged when present. */
40
+ retryAfter;
41
+ /**
42
+ * @param message - The error text shown in the tool result.
43
+ * @param response - The GitLab response the error describes; supplies status
44
+ * and Retry-After when given.
45
+ */
46
+ constructor(message, response) {
38
47
  super(message);
39
48
  this.name = "GitLabApiRequestHttpError";
49
+ if (response) {
50
+ this.status = response.status;
51
+ this.retryAfter = response.headers.get("retry-after") ?? undefined;
52
+ }
40
53
  }
41
54
  }
42
55
  const REQUEST_TIMEOUT_MS = 45_000;
@@ -253,7 +266,7 @@ export async function executeGitLabApiRequestAsync(input) {
253
266
  });
254
267
  const rawBody = await response.text();
255
268
  if (!response.ok) {
256
- throw new GitLabApiRequestHttpError(formatHttpError(response.status, response.statusText, rawBody));
269
+ throw new GitLabApiRequestHttpError(formatHttpError(response.status, response.statusText, rawBody), response);
257
270
  }
258
271
  return { content: [{ type: "text", text: formatSuccessBody(rawBody) }] };
259
272
  }
@@ -1,7 +1,7 @@
1
1
  import { toJSONSchema } from "../utils/schema.js";
2
2
  import { USE_GITLAB_WIKI, USE_MILESTONE, USE_PIPELINE, SSE, STREAMABLE_HTTP } from "../config.js";
3
3
  import { getToolDescription } from "./tool-descriptions.js";
4
- import { ApproveMergeRequestSchema, BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, ConvertWorkItemTypeSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateGroupSchema, CreateGroupWikiPageSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateLabelSchema, MarkAllTodosDoneSchema, ListTodosSchema, MarkTodoDoneSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestNoteSchema, CreateMergeRequestNoteEmojiReactionSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateGroupMilestoneSchema, CreateReleaseEvidenceSchema, CreateReleaseSchema, CreateRepositorySchema, CreateTagSchema, CreateTimelineEventSchema, CreateWebhookSchema, CreateWikiPageSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, CreateWorkItemSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UpdateProtectedBranchSchema, ProtectTagSchema, UnprotectBranchSchema, UnprotectTagSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteGroupMilestoneSchema, DeleteGroupWikiPageSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestDiscussionNoteSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, DeleteProjectMilestoneSchema, DeleteReleaseSchema, DeleteTagSchema, DeleteWebhookSchema, DeleteWikiPageSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, DownloadAttachmentSchema, DownloadAttachmentRemoteSchema, DownloadJobArtifactsSchema, DownloadJobArtifactsRemoteSchema, DownloadReleaseAssetSchema, EditProjectMilestoneSchema, EditGroupMilestoneSchema, ExecuteGraphQLSchema, ForkRepositorySchema, HealthCheckSchema, GetBranchSchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetDraftNoteSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetFileContentsSchema, GetGroupWikiPageSchema, GetIssueLinkSchema, GetIssueSchema, GetJobArtifactFileSchema, GetLabelSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GetMergeRequestDiffsSchema, GetMergeRequestFileDiffSchema, GetMergeRequestDiscussionSchema, GetMergeRequestNoteSchema, GetMergeRequestNotesSchema, GetMergeRequestSchema, GetMergeRequestVersionSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneBurndownEventsSchema, GetNamespaceSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetRunnerSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectEventsSchema, GetProjectMilestoneSchema, GetProjectSchema, GetReleaseSchema, GetRepositoryTreeSchema, GetTagSchema, GetTagSignatureSchema, GetProtectedTagSchema, GetTimelineEventsSchema, GetUsersSchema, GetUserSchema, WhoAmISchema, GetWebhookEventSchema, GetWikiPageSchema, GetWorkItemSchema, ListBranchesSchema, ListCommitsSchema, ListCommitStatusesSchema, ListCustomFieldDefinitionsSchema, ListDeploymentsSchema, ListDraftNotesSchema, ListEnvironmentsSchema, ListEventsSchema, ListGroupIterationsSchema, GetGroupIterationSchema, UpdateGroupIterationSchema, ListGroupMilestonesSchema, ListGroupProjectsSchema, ListGroupWikiPagesSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListJobArtifactsSchema, ListLabelsSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiffsSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestVersionsSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListPipelinesSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, ListGroupMembersSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListProjectRunnersSchema, ListReleasesSchema, ListTagsSchema, ListProtectedTagsSchema, ListWebhookEventsSchema, ListWebhooksSchema, ListWikiPagesSchema, ListWorkItemNotesSchema, ListWorkItemStatusesSchema, ListWorkItemsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, MergeMergeRequestSchema, MoveWorkItemSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, PlayPipelineJobSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, ResolveMergeRequestThreadSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, ListSnippetsSchema, GetSnippetSchema, CreateSnippetSchema, UpdateSnippetSchema, DeleteSnippetSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, UpdateDraftNoteSchema, UpdateGroupWikiPageSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateReleaseSchema, UpdateWebhookSchema, UpdateWikiPageSchema, UpdateWorkItemSchema, VerifyNamespaceSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, } from "../schemas.js";
4
+ import { ApproveMergeRequestSchema, BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, ConvertWorkItemTypeSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateGroupSchema, CreateGroupWikiPageSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateLabelSchema, MarkAllTodosDoneSchema, ListTodosSchema, MarkTodoDoneSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestNoteSchema, CreateMergeRequestNoteEmojiReactionSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateGroupMilestoneSchema, CreateReleaseEvidenceSchema, CreateReleaseSchema, CreateRepositorySchema, CreateTagSchema, CreateTimelineEventSchema, CreateWebhookSchema, CreateWikiPageSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, CreateWorkItemSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UpdateProtectedBranchSchema, ProtectTagSchema, UnprotectBranchSchema, UnprotectTagSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteGroupMilestoneSchema, DeleteGroupWikiPageSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestDiscussionNoteSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, DeleteProjectMilestoneSchema, DeleteReleaseSchema, DeleteTagSchema, DeleteWebhookSchema, DeleteWikiPageSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, DownloadAttachmentSchema, DownloadAttachmentRemoteSchema, DownloadJobArtifactsSchema, DownloadJobArtifactsRemoteSchema, DownloadReleaseAssetSchema, EditProjectMilestoneSchema, EditGroupMilestoneSchema, ExecuteGraphQLSchema, ForkRepositorySchema, HealthCheckSchema, GetBranchSchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetDraftNoteSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetFileContentsSchema, GetGroupWikiPageSchema, GetIssueLinkSchema, GetIssueSchema, GetJobArtifactFileSchema, GetLabelSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GetMergeRequestDiffsSchema, GetMergeRequestFileDiffSchema, GetMergeRequestDiscussionSchema, GetMergeRequestNoteSchema, GetMergeRequestNotesSchema, GetMergeRequestSchema, GetMergeRequestVersionSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneBurndownEventsSchema, GetNamespaceSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetRunnerSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectEventsSchema, GetProjectMilestoneSchema, GetProjectSchema, GetReleaseSchema, GetRepositoryTreeSchema, GetTagSchema, GetTagSignatureSchema, GetProtectedTagSchema, GetTimelineEventsSchema, GetUsersSchema, GetUserSchema, WhoAmISchema, GetWebhookEventSchema, GetWikiPageSchema, GetWorkItemSchema, ListBranchesSchema, ListCommitsSchema, ListCommitStatusesSchema, ListCustomFieldDefinitionsSchema, ListDeploymentsSchema, ListDraftNotesSchema, ListEnvironmentsSchema, ListEventsSchema, ListGroupIterationsSchema, GetGroupIterationSchema, UpdateGroupIterationSchema, CreateGroupIterationSchema, ListGroupIterationCadencesSchema, DeleteGroupIterationSchema, ListProjectIterationsSchema, CreateGroupIterationCadenceSchema, UpdateGroupIterationCadenceSchema, DeleteGroupIterationCadenceSchema, ListGroupMilestonesSchema, ListGroupProjectsSchema, ListGroupWikiPagesSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListJobArtifactsSchema, ListLabelsSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiffsSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestVersionsSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListPipelinesSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, ListGroupMembersSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListProjectRunnersSchema, ListReleasesSchema, ListTagsSchema, ListProtectedTagsSchema, ListWebhookEventsSchema, ListWebhooksSchema, ListWikiPagesSchema, ListWorkItemNotesSchema, ListWorkItemStatusesSchema, ListWorkItemsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, MergeMergeRequestSchema, MoveWorkItemSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, PlayPipelineJobSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, ResolveMergeRequestThreadSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, ListSnippetsSchema, GetSnippetSchema, CreateSnippetSchema, UpdateSnippetSchema, DeleteSnippetSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, UpdateDraftNoteSchema, UpdateGroupWikiPageSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateReleaseSchema, UpdateWebhookSchema, UpdateWikiPageSchema, UpdateWorkItemSchema, VerifyNamespaceSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, } from "../schemas.js";
5
5
  import { GitLabApiRequestSchema } from "./gitlab-api-request.js";
6
6
  import { HelpInputSchema } from "../server/mcp-help.js";
7
7
  const IS_REMOTE = SSE || STREAMABLE_HTTP;
@@ -1010,6 +1010,41 @@ export const allTools = [
1010
1010
  description: "Update a manual group iteration's title, description, or dates. At least one of `title`, `description`, `start_date`, or `due_date` is required.",
1011
1011
  inputSchema: toJSONSchema(UpdateGroupIterationSchema),
1012
1012
  },
1013
+ {
1014
+ name: "create_group_iteration",
1015
+ description: "Create a group iteration, optionally in a given iteration cadence",
1016
+ inputSchema: toJSONSchema(CreateGroupIterationSchema),
1017
+ },
1018
+ {
1019
+ name: "delete_group_iteration",
1020
+ description: "Delete a group iteration by ID, IID, or GraphQL GID",
1021
+ inputSchema: toJSONSchema(DeleteGroupIterationSchema),
1022
+ },
1023
+ {
1024
+ name: "list_project_iterations",
1025
+ description: "List the iterations available to a project with filtering options",
1026
+ inputSchema: toJSONSchema(ListProjectIterationsSchema),
1027
+ },
1028
+ {
1029
+ name: "list_group_iteration_cadences",
1030
+ description: "List a group's iteration cadences with filtering options",
1031
+ inputSchema: toJSONSchema(ListGroupIterationCadencesSchema),
1032
+ },
1033
+ {
1034
+ name: "create_group_iteration_cadence",
1035
+ description: "Create an iteration cadence in a group",
1036
+ inputSchema: toJSONSchema(CreateGroupIterationCadenceSchema),
1037
+ },
1038
+ {
1039
+ name: "update_group_iteration_cadence",
1040
+ description: "Update an iteration cadence's title, description, schedule, or automation",
1041
+ inputSchema: toJSONSchema(UpdateGroupIterationCadenceSchema),
1042
+ },
1043
+ {
1044
+ name: "delete_group_iteration_cadence",
1045
+ description: "Delete an iteration cadence",
1046
+ inputSchema: toJSONSchema(DeleteGroupIterationCadenceSchema),
1047
+ },
1013
1048
  {
1014
1049
  name: "upload_markdown",
1015
1050
  description: IS_REMOTE
@@ -1551,6 +1586,8 @@ export const readOnlyTools = new Set([
1551
1586
  "list_commit_statuses",
1552
1587
  "list_group_iterations",
1553
1588
  "get_group_iteration",
1589
+ "list_group_iteration_cadences",
1590
+ "list_project_iterations",
1554
1591
  "download_attachment",
1555
1592
  "list_events",
1556
1593
  "get_project_events",
@@ -1627,6 +1664,8 @@ export const destructiveTools = new Set([
1627
1664
  "delete_group_wiki_page",
1628
1665
  "delete_milestone",
1629
1666
  "delete_group_milestone",
1667
+ "delete_group_iteration",
1668
+ "delete_group_iteration_cadence",
1630
1669
  "delete_release",
1631
1670
  "delete_tag",
1632
1671
  "delete_webhook",
@@ -1677,6 +1716,8 @@ export const deleteTools = new Set([
1677
1716
  "delete_group_variable",
1678
1717
  "delete_group_wiki_page",
1679
1718
  "delete_group_milestone",
1719
+ "delete_group_iteration",
1720
+ "delete_group_iteration_cadence",
1680
1721
  "delete_issue",
1681
1722
  "delete_issue_emoji_reaction",
1682
1723
  "delete_issue_link",
@@ -1982,6 +2023,13 @@ export const TOOLSET_DEFINITIONS = [
1982
2023
  "list_group_iterations",
1983
2024
  "get_group_iteration",
1984
2025
  "update_group_iteration",
2026
+ "create_group_iteration",
2027
+ "delete_group_iteration",
2028
+ "list_project_iterations",
2029
+ "list_group_iteration_cadences",
2030
+ "create_group_iteration_cadence",
2031
+ "update_group_iteration_cadence",
2032
+ "delete_group_iteration_cadence",
1985
2033
  "health_check",
1986
2034
  ]),
1987
2035
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.15-next.178",
3
+ "version": "2.3.15-next.180",
4
4
  "mcpName": "io.github.zereight/gitlab-mcp",
5
5
  "description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
6
6
  "keywords": [