@zereight/mcp-gitlab 2.3.15-next.177 → 2.3.15-next.179

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, 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, 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;
1323
+ }
1324
+ const meta = {};
1325
+ if (error.status !== undefined) {
1326
+ meta.status = error.status;
1298
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) {
@@ -2964,7 +2997,10 @@ async function updateWorkItem(projectId, iid, options) {
2964
2997
  inputParts.push("milestoneWidget: { milestoneId: $milestoneId }");
2965
2998
  variables.milestoneId = milestoneGID;
2966
2999
  }
2967
- if (options.iteration_id !== undefined) {
3000
+ if (options.remove_iteration) {
3001
+ inputParts.push("iterationWidget: { iterationId: null }");
3002
+ }
3003
+ else if (options.iteration_id !== undefined) {
2968
3004
  const iterationGID = options.iteration_id.startsWith("gid://")
2969
3005
  ? options.iteration_id
2970
3006
  : `gid://gitlab/Iteration/${options.iteration_id}`;
@@ -3031,6 +3067,7 @@ async function updateWorkItem(projectId, iid, options) {
3031
3067
  ... on WorkItemWidgetHealthStatus { healthStatus }
3032
3068
  ... on WorkItemWidgetStartAndDueDate { startDate dueDate }
3033
3069
  ... on WorkItemWidgetMilestone { milestone { id title } }
3070
+ ... on WorkItemWidgetIteration { iteration { id iid title } }
3034
3071
  }
3035
3072
  }
3036
3073
  errors
@@ -3118,6 +3155,7 @@ async function updateWorkItem(projectId, iid, options) {
3118
3155
  const healthStatusW = widgets.find((w) => w.__typename === "WorkItemWidgetHealthStatus");
3119
3156
  const datesW = widgets.find((w) => w.__typename === "WorkItemWidgetStartAndDueDate");
3120
3157
  const milestoneW = widgets.find((w) => w.__typename === "WorkItemWidgetMilestone");
3158
+ const iterationW = widgets.find((w) => w.__typename === "WorkItemWidgetIteration");
3121
3159
  return {
3122
3160
  id: wi.id,
3123
3161
  iid: wi.iid,
@@ -3134,6 +3172,7 @@ async function updateWorkItem(projectId, iid, options) {
3134
3172
  startDate: datesW?.startDate || null,
3135
3173
  dueDate: datesW?.dueDate || null,
3136
3174
  milestone: milestoneW?.milestone || null,
3175
+ iteration: iterationW?.iteration || null,
3137
3176
  children_added: options.children_to_add?.length || 0,
3138
3177
  children_removed: options.children_to_remove?.length || 0,
3139
3178
  linked_items_added: options.linked_items_to_add?.length || 0,
@@ -3264,11 +3303,11 @@ async function createMergeRequest(projectId, options) {
3264
3303
  });
3265
3304
  if (response.status === 400) {
3266
3305
  const errorBody = await response.text();
3267
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3306
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3268
3307
  }
3269
3308
  if (!response.ok) {
3270
3309
  const errorBody = await response.text();
3271
- 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);
3272
3311
  }
3273
3312
  const data = await response.json();
3274
3313
  return GitLabMergeRequestSchema.parse(data);
@@ -3356,7 +3395,7 @@ async function deleteMergeRequestDiscussionNote(projectId, mergeRequestIid, disc
3356
3395
  });
3357
3396
  if (!response.ok) {
3358
3397
  const errorText = await response.text();
3359
- 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);
3360
3399
  }
3361
3400
  }
3362
3401
  /**
@@ -3518,7 +3557,7 @@ async function deleteMergeRequestNote(projectId, mergeRequestIid, noteId) {
3518
3557
  });
3519
3558
  if (!response.ok) {
3520
3559
  const errorText = await response.text();
3521
- 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);
3522
3561
  }
3523
3562
  }
3524
3563
  // --- Emoji Reactions (REST) ---
@@ -3689,7 +3728,7 @@ async function createOrUpdateFile(projectId, filePath, content, commitMessage, b
3689
3728
  });
3690
3729
  if (!response.ok) {
3691
3730
  const errorBody = await response.text();
3692
- 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);
3693
3732
  }
3694
3733
  const data = await response.json();
3695
3734
  return GitLabCreateUpdateFileResponseSchema.parse(data);
@@ -3718,11 +3757,11 @@ async function createCommit(projectId, message, branch, actions) {
3718
3757
  });
3719
3758
  if (response.status === 400) {
3720
3759
  const errorBody = await response.text();
3721
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3760
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3722
3761
  }
3723
3762
  if (!response.ok) {
3724
3763
  const errorBody = await response.text();
3725
- 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);
3726
3765
  }
3727
3766
  const data = await response.json();
3728
3767
  return GitLabCommitSchema.parse(data);
@@ -3748,7 +3787,7 @@ async function searchProjects(query, page = 1, perPage = 20) {
3748
3787
  });
3749
3788
  if (!response.ok) {
3750
3789
  const errorBody = await response.text();
3751
- 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);
3752
3791
  }
3753
3792
  const unfiltered = (await response.json());
3754
3793
  const projects = filterProjectsByAllowlist(unfiltered);
@@ -3835,7 +3874,7 @@ async function createRepository(options) {
3835
3874
  });
3836
3875
  if (!response.ok) {
3837
3876
  const errorBody = await response.text();
3838
- 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);
3839
3878
  }
3840
3879
  const data = await response.json();
3841
3880
  return GitLabRepositorySchema.parse(data);
@@ -4209,7 +4248,7 @@ async function getBranchDiffs(projectId, from, to, straight) {
4209
4248
  });
4210
4249
  if (!response.ok) {
4211
4250
  const errorBody = await response.text();
4212
- 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);
4213
4252
  }
4214
4253
  const data = await response.json();
4215
4254
  return GitLabCompareResultSchema.parse(data);
@@ -4450,7 +4489,7 @@ noteableIid, body) {
4450
4489
  });
4451
4490
  if (!response.ok) {
4452
4491
  const errorText = await response.text();
4453
- 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);
4454
4493
  }
4455
4494
  return await response.json();
4456
4495
  }
@@ -4465,7 +4504,7 @@ async function getDraftNote(project_id, merge_request_iid, draft_note_id) {
4465
4504
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/merge_requests/${encodeGitLabPathSegment(merge_request_iid)}/draft_notes/${encodeGitLabPathSegment(draft_note_id)}`, { ...getFetchConfig() });
4466
4505
  if (!response.ok) {
4467
4506
  const errorText = await response.text();
4468
- 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);
4469
4508
  }
4470
4509
  const data = await response.json();
4471
4510
  return GitLabDraftNoteSchema.parse(data);
@@ -4479,7 +4518,7 @@ async function listDraftNotes(projectId, mergeRequestIid) {
4479
4518
  });
4480
4519
  if (!response.ok) {
4481
4520
  const errorText = await response.text();
4482
- 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);
4483
4522
  }
4484
4523
  const data = await response.json();
4485
4524
  return z.array(GitLabDraftNoteSchema).parse(data);
@@ -4514,7 +4553,7 @@ async function createDraftNote(projectId, mergeRequestIid, body, inReplyToDiscus
4514
4553
  });
4515
4554
  if (!response.ok) {
4516
4555
  const errorText = await response.text();
4517
- 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);
4518
4557
  }
4519
4558
  const data = await response.json();
4520
4559
  return GitLabDraftNoteSchema.parse(data);
@@ -4549,7 +4588,7 @@ async function updateDraftNote(projectId, mergeRequestIid, draftNoteId, body, po
4549
4588
  });
4550
4589
  if (!response.ok) {
4551
4590
  const errorText = await response.text();
4552
- 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);
4553
4592
  }
4554
4593
  const data = await response.json();
4555
4594
  return GitLabDraftNoteSchema.parse(data);
@@ -4570,7 +4609,7 @@ async function deleteDraftNote(projectId, mergeRequestIid, draftNoteId) {
4570
4609
  });
4571
4610
  if (!response.ok) {
4572
4611
  const errorText = await response.text();
4573
- 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);
4574
4613
  }
4575
4614
  }
4576
4615
  /**
@@ -4589,7 +4628,7 @@ async function publishDraftNote(projectId, mergeRequestIid, draftNoteId) {
4589
4628
  });
4590
4629
  if (!response.ok) {
4591
4630
  const errorText = await response.text();
4592
- 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);
4593
4632
  }
4594
4633
  // Handle empty response (204 No Content) or successful response
4595
4634
  const responseText = await response.text();
@@ -4692,7 +4731,7 @@ async function bulkPublishDraftNotes(projectId, mergeRequestIid, options = {}) {
4692
4731
  });
4693
4732
  if (!response.ok) {
4694
4733
  const errorText = await response.text();
4695
- 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);
4696
4735
  }
4697
4736
  // Handle empty response (204 No Content) or successful response
4698
4737
  const responseText = await response.text();
@@ -4723,7 +4762,7 @@ async function resolveMergeRequestThread(projectId, mergeRequestIid, discussionI
4723
4762
  });
4724
4763
  if (!response.ok) {
4725
4764
  const errorText = await response.text();
4726
- 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);
4727
4766
  }
4728
4767
  }
4729
4768
  /**
@@ -5315,7 +5354,7 @@ async function getPipeline(projectId, pipelineId, signal) {
5315
5354
  signal,
5316
5355
  });
5317
5356
  if (response.status === 404) {
5318
- throw new GitLabApiError(`Pipeline not found`);
5357
+ throw new GitLabApiError(`Pipeline not found`, response);
5319
5358
  }
5320
5359
  await handleGitLabError(response);
5321
5360
  const data = await response.json();
@@ -5388,7 +5427,7 @@ async function getDeployment(projectId, deploymentId) {
5388
5427
  ...getFetchConfig(),
5389
5428
  });
5390
5429
  if (response.status === 404) {
5391
- throw new GitLabApiError(`Deployment not found`);
5430
+ throw new GitLabApiError(`Deployment not found`, response);
5392
5431
  }
5393
5432
  await handleGitLabError(response);
5394
5433
  const data = await response.json();
@@ -5441,7 +5480,7 @@ async function getEnvironment(projectId, environmentId) {
5441
5480
  ...getFetchConfig(),
5442
5481
  });
5443
5482
  if (response.status === 404) {
5444
- throw new GitLabApiError(`Environment not found`);
5483
+ throw new GitLabApiError(`Environment not found`, response);
5445
5484
  }
5446
5485
  await handleGitLabError(response);
5447
5486
  const data = await response.json();
@@ -5564,7 +5603,7 @@ async function getRunner(runnerId, projectId) {
5564
5603
  ...getFetchConfig(),
5565
5604
  });
5566
5605
  if (response.status === 404) {
5567
- throw new GitLabApiError("Runner not found");
5606
+ throw new GitLabApiError("Runner not found", response);
5568
5607
  }
5569
5608
  await handleGitLabError(response);
5570
5609
  const details = redactSensitiveGitLabFields(await response.json());
@@ -5628,7 +5667,7 @@ async function listPipelineJobs(projectId, pipelineId, options = {}) {
5628
5667
  ...getFetchConfig(),
5629
5668
  });
5630
5669
  if (response.status === 404) {
5631
- throw new GitLabApiError(`Pipeline not found`);
5670
+ throw new GitLabApiError(`Pipeline not found`, response);
5632
5671
  }
5633
5672
  await handleGitLabError(response);
5634
5673
  const data = await response.json();
@@ -5651,7 +5690,7 @@ async function listPipelineTriggerJobs(projectId, pipelineId, options = {}) {
5651
5690
  ...getFetchConfig(),
5652
5691
  });
5653
5692
  if (response.status === 404) {
5654
- throw new GitLabApiError(`Pipeline not found`);
5693
+ throw new GitLabApiError(`Pipeline not found`, response);
5655
5694
  }
5656
5695
  await handleGitLabError(response);
5657
5696
  const data = await response.json();
@@ -5665,7 +5704,7 @@ async function getPipelineJob(projectId, jobId, signal) {
5665
5704
  signal,
5666
5705
  });
5667
5706
  if (response.status === 404) {
5668
- throw new GitLabApiError(`Job not found`);
5707
+ throw new GitLabApiError(`Job not found`, response);
5669
5708
  }
5670
5709
  await handleGitLabError(response);
5671
5710
  const data = await response.json();
@@ -5689,7 +5728,7 @@ async function getPipelineJobOutput(projectId, jobId, query = {}) {
5689
5728
  },
5690
5729
  });
5691
5730
  if (response.status === 404) {
5692
- 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);
5693
5732
  }
5694
5733
  await handleGitLabError(response);
5695
5734
  const pattern = query.pattern;
@@ -5778,7 +5817,7 @@ async function listJobArtifacts(projectId, jobId, options = {}) {
5778
5817
  ...getFetchConfig(),
5779
5818
  });
5780
5819
  if (response.status === 404) {
5781
- 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);
5782
5821
  }
5783
5822
  await handleGitLabError(response);
5784
5823
  const data = await response.json();
@@ -5798,7 +5837,7 @@ async function downloadJobArtifacts(projectId, jobId, localPath) {
5798
5837
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts`);
5799
5838
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5800
5839
  if (response.status === 404) {
5801
- 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);
5802
5841
  }
5803
5842
  await handleGitLabError(response);
5804
5843
  const filename = `artifacts_job_${encodeGitLabPathSegment(jobId)}.zip`;
@@ -5832,7 +5871,7 @@ async function getJobArtifactFile(projectId, jobId, artifactPath) {
5832
5871
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts/${encodedArtifactPath}`);
5833
5872
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5834
5873
  if (response.status === 404) {
5835
- throw new GitLabApiError(`Artifact file not found: ${artifactPath}`);
5874
+ throw new GitLabApiError(`Artifact file not found: ${artifactPath}`, response);
5836
5875
  }
5837
5876
  await handleGitLabError(response);
5838
5877
  return await response.text();
@@ -6308,10 +6347,10 @@ async function getRepositoryTree(options) {
6308
6347
  queryParams.append("pagination", options.pagination);
6309
6348
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(options.project_id))}/repository/tree?${queryParams.toString()}`, { ...getFetchConfig() });
6310
6349
  if (response.status === 404) {
6311
- throw new GitLabApiError("Repository or path not found");
6350
+ throw new GitLabApiError("Repository or path not found", response);
6312
6351
  }
6313
6352
  if (!response.ok) {
6314
- throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`);
6353
+ throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`, response);
6315
6354
  }
6316
6355
  const data = await response.json();
6317
6356
  const items = z.array(GitLabTreeItemSchema).parse(data);
@@ -7001,6 +7040,94 @@ async function listGroupIterations(groupId, options = {}) {
7001
7040
  const data = await response.json();
7002
7041
  return z.array(GroupIteration).parse(data);
7003
7042
  }
7043
+ const ITERATION_GID_PREFIX = "gid://gitlab/Iteration/";
7044
+ function normalizeIterationLookupId(iterationId) {
7045
+ const decoded = decodeURIComponent(iterationId);
7046
+ const isGraphqlGid = decoded.startsWith(ITERATION_GID_PREFIX);
7047
+ return {
7048
+ targetId: isGraphqlGid ? decoded.slice(ITERATION_GID_PREFIX.length) : decoded,
7049
+ isGraphqlGid,
7050
+ };
7051
+ }
7052
+ function selectGroupIterationMatch(idMatch, iidMatch, iterationId, groupId) {
7053
+ if (idMatch && iidMatch && idMatch.id !== iidMatch.id) {
7054
+ throw new ToolInputError(`Group iteration ${iterationId} is ambiguous in group ${groupId}`);
7055
+ }
7056
+ if (idMatch)
7057
+ return idMatch;
7058
+ if (iidMatch)
7059
+ return iidMatch;
7060
+ throw new ToolInputError(`Group iteration ${iterationId} was not found in group ${groupId}`);
7061
+ }
7062
+ async function getGroupIteration(groupId, iterationId) {
7063
+ const { targetId, isGraphqlGid } = normalizeIterationLookupId(iterationId);
7064
+ let idMatch;
7065
+ let iidMatch;
7066
+ for (let page = 1;; page += 1) {
7067
+ const iterations = await listGroupIterations(groupId, {
7068
+ state: "all",
7069
+ include_ancestors: false,
7070
+ page,
7071
+ per_page: 100,
7072
+ });
7073
+ for (const iteration of iterations) {
7074
+ if (iteration.id === targetId) {
7075
+ idMatch = iteration;
7076
+ }
7077
+ else if (!isGraphqlGid && iteration.iid === targetId) {
7078
+ iidMatch = iteration;
7079
+ }
7080
+ }
7081
+ if (iterations.length < 100)
7082
+ break;
7083
+ }
7084
+ if (isGraphqlGid) {
7085
+ if (idMatch)
7086
+ return idMatch;
7087
+ throw new ToolInputError(`Group iteration ${iterationId} was not found in group ${groupId}`);
7088
+ }
7089
+ return selectGroupIterationMatch(idMatch, iidMatch, iterationId, groupId);
7090
+ }
7091
+ async function updateGroupIteration(groupId, iterationId, options) {
7092
+ if (options.title === undefined &&
7093
+ options.description === undefined &&
7094
+ options.start_date === undefined &&
7095
+ options.due_date === undefined) {
7096
+ throw new ToolInputError("Provide at least one iteration field to update");
7097
+ }
7098
+ const current = await getGroupIteration(groupId, iterationId);
7099
+ const groupReference = /^group:/i.test(groupId) ? groupId : `group:${groupId}`;
7100
+ const { path: groupPath } = await resolveProjectOrGroupPath(groupReference);
7101
+ const input = {
7102
+ groupPath,
7103
+ id: `${ITERATION_GID_PREFIX}${current.id}`,
7104
+ };
7105
+ if (options.title !== undefined)
7106
+ input.title = options.title;
7107
+ if (options.description !== undefined)
7108
+ input.description = options.description;
7109
+ if (options.start_date !== undefined)
7110
+ input.startDate = options.start_date;
7111
+ if (options.due_date !== undefined)
7112
+ input.dueDate = options.due_date;
7113
+ const mutation = `
7114
+ mutation UpdateGroupIteration($input: UpdateIterationInput!) {
7115
+ updateIteration(input: $input) {
7116
+ iteration { id }
7117
+ errors
7118
+ }
7119
+ }
7120
+ `;
7121
+ const data = await executeGraphQL(mutation, { input });
7122
+ const result = data.updateIteration;
7123
+ if (result.errors.length > 0) {
7124
+ throw new ToolInputError(`Failed to update group iteration: ${result.errors.join(", ")}`);
7125
+ }
7126
+ if (!result.iteration) {
7127
+ throw new ToolInputError("Failed to update group iteration: GitLab returned no iteration");
7128
+ }
7129
+ return getGroupIteration(groupId, `${ITERATION_GID_PREFIX}${current.id}`);
7130
+ }
7004
7131
  // --- CI/CD Variables ---
7005
7132
  async function listProjectVariables(projectId, options = {}) {
7006
7133
  projectId = decodeURIComponent(projectId);
@@ -8159,7 +8286,11 @@ async function handleToolCall(params) {
8159
8286
  throw new ToolInputError(error.message);
8160
8287
  }
8161
8288
  if (error instanceof GitLabApiRequestHttpError) {
8162
- throw new GitLabApiError(error.message);
8289
+ // Carry the HTTP fields (status, Retry-After) into the tool error result.
8290
+ const apiError = new GitLabApiError(error.message);
8291
+ apiError.status = error.status;
8292
+ apiError.retryAfter = error.retryAfter;
8293
+ throw apiError;
8163
8294
  }
8164
8295
  throw error;
8165
8296
  }
@@ -10468,6 +10599,23 @@ async function handleToolCall(params) {
10468
10599
  content: [{ type: "text", text: JSON.stringify(iterations) }],
10469
10600
  };
10470
10601
  }
10602
+ case "get_group_iteration": {
10603
+ rejectIfStrictProjectScope("get_group_iteration");
10604
+ const args = GetGroupIterationSchema.parse(params.arguments);
10605
+ const iteration = await getGroupIteration(args.group_id, args.iteration_id);
10606
+ return {
10607
+ content: [{ type: "text", text: JSON.stringify(iteration) }],
10608
+ };
10609
+ }
10610
+ case "update_group_iteration": {
10611
+ rejectIfStrictProjectScope("update_group_iteration");
10612
+ const args = UpdateGroupIterationSchema.parse(params.arguments);
10613
+ const { group_id, iteration_id, ...options } = args;
10614
+ const iteration = await updateGroupIteration(group_id, iteration_id, options);
10615
+ return {
10616
+ content: [{ type: "text", text: JSON.stringify(iteration) }],
10617
+ };
10618
+ }
10471
10619
  // --- CI/CD Variables ---
10472
10620
  case "list_project_variables": {
10473
10621
  const args = ListProjectVariablesSchema.parse(params.arguments);
package/build/schemas.js CHANGED
@@ -3604,6 +3604,32 @@ export const ListGroupIterationsSchema = z
3604
3604
  .describe("Return only iterations updated after the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z)."),
3605
3605
  })
3606
3606
  .merge(PaginationOptionsSchema);
3607
+ /**
3608
+ * A required identifier that also accepts a numeric JSON value.
3609
+ *
3610
+ * `z.coerce.string()` would accept numbers too, but it turns a missing value into the
3611
+ * string "undefined", so an omitted ID would pass validation. Converting only numbers
3612
+ * keeps a missing or empty ID a validation error.
3613
+ */
3614
+ const requiredIterationIdentifier = (description) => z
3615
+ .preprocess(value => (typeof value === "number" ? String(value) : value), z.string().min(1))
3616
+ .describe(description);
3617
+ export const GetGroupIterationSchema = z.object({
3618
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3619
+ iteration_id: requiredIterationIdentifier("Iteration ID, IID, or GraphQL GID"),
3620
+ });
3621
+ export const UpdateGroupIterationSchema = z.object({
3622
+ group_id: requiredIterationIdentifier("Group ID or URL-encoded path"),
3623
+ iteration_id: requiredIterationIdentifier("Iteration ID, IID, or GraphQL GID"),
3624
+ title: z.string().optional().describe("New iteration title"),
3625
+ description: z
3626
+ .string()
3627
+ .nullable()
3628
+ .optional()
3629
+ .describe("New iteration description; null clears it"),
3630
+ start_date: z.string().optional().describe("New start date in YYYY-MM-DD format"),
3631
+ due_date: z.string().optional().describe("New due date in YYYY-MM-DD format"),
3632
+ });
3607
3633
  // Events API schemas
3608
3634
  export const GitLabEventAuthorSchema = z.object({
3609
3635
  id: z.coerce.string(),
@@ -4379,6 +4405,7 @@ export const UpdateWorkItemSchema = WorkItemParamsSchema.extend({
4379
4405
  .string()
4380
4406
  .optional()
4381
4407
  .describe("Iteration ID (e.g. 'gid://gitlab/Iteration/123' or numeric ID). Use list_group_iterations to find available iterations."),
4408
+ remove_iteration: flexibleBooleanOptional.describe("Set to true to remove the work item's iteration association. Mutually exclusive with iteration_id."),
4382
4409
  confidential: coerceBooleanString.optional().describe("Set confidentiality"),
4383
4410
  linked_items_to_add: z
4384
4411
  .array(z.object({
@@ -4431,6 +4458,8 @@ export const UpdateWorkItemSchema = WorkItemParamsSchema.extend({
4431
4458
  .enum(["TRIGGERED", "ACKNOWLEDGED", "RESOLVED", "IGNORED"])
4432
4459
  .optional()
4433
4460
  .describe("Incident only: set escalation status"),
4461
+ }).refine(args => !(args.remove_iteration && args.iteration_id !== undefined), {
4462
+ message: "Provide either iteration_id or remove_iteration, not both",
4434
4463
  });
4435
4464
  export const ConvertWorkItemTypeSchema = z.object({
4436
4465
  project_id: NamespaceIdOrPathSchema,
@@ -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, 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, 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;
@@ -1000,6 +1000,16 @@ export const allTools = [
1000
1000
  description: "List group iterations with filtering options",
1001
1001
  inputSchema: toJSONSchema(ListGroupIterationsSchema),
1002
1002
  },
1003
+ {
1004
+ name: "get_group_iteration",
1005
+ description: "Get a group iteration by ID, IID, or GraphQL GID",
1006
+ inputSchema: toJSONSchema(GetGroupIterationSchema),
1007
+ },
1008
+ {
1009
+ name: "update_group_iteration",
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
+ inputSchema: toJSONSchema(UpdateGroupIterationSchema),
1012
+ },
1003
1013
  {
1004
1014
  name: "upload_markdown",
1005
1015
  description: IS_REMOTE
@@ -1159,7 +1169,7 @@ export const allTools = [
1159
1169
  },
1160
1170
  {
1161
1171
  name: "update_work_item",
1162
- description: "Update a work item (title, description, labels, assignees, state, parent, custom fields, etc.)",
1172
+ description: "Update a work item (title, description, labels, assignees, state, parent, iteration, custom fields, etc.). Use remove_iteration to explicitly clear the iteration association.",
1163
1173
  inputSchema: toJSONSchema(UpdateWorkItemSchema),
1164
1174
  },
1165
1175
  {
@@ -1970,6 +1980,8 @@ export const TOOLSET_DEFINITIONS = [
1970
1980
  "verify_namespace",
1971
1981
  "list_group_projects",
1972
1982
  "list_group_iterations",
1983
+ "get_group_iteration",
1984
+ "update_group_iteration",
1973
1985
  "health_check",
1974
1986
  ]),
1975
1987
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.15-next.177",
3
+ "version": "2.3.15-next.179",
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": [