@zereight/mcp-gitlab 2.0.25 → 2.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/build/index.js +520 -136
- package/build/schemas.js +268 -90
- package/build/test/test-download-attachment.js +144 -0
- package/build/test/test-toolset-filtering.js +451 -0
- package/build/test-resolve-issue-note.js +127 -0
- package/package.json +3 -2
package/build/schemas.js
CHANGED
|
@@ -188,9 +188,7 @@ export const ListPipelinesSchema = z
|
|
|
188
188
|
.describe("The status of pipelines"),
|
|
189
189
|
ref: z.string().optional().describe("The ref of pipelines"),
|
|
190
190
|
sha: z.string().optional().describe("The SHA of pipelines"),
|
|
191
|
-
yaml_errors: z.boolean()
|
|
192
|
-
.optional()
|
|
193
|
-
.describe("Returns pipelines with invalid configurations"),
|
|
191
|
+
yaml_errors: z.boolean().optional().describe("Returns pipelines with invalid configurations"),
|
|
194
192
|
username: z.string().optional().describe("The username of the user who triggered pipelines"),
|
|
195
193
|
updated_after: z
|
|
196
194
|
.string()
|
|
@@ -300,7 +298,7 @@ export const PlayPipelineJobSchema = z.object({
|
|
|
300
298
|
});
|
|
301
299
|
// Schema for retrying a job
|
|
302
300
|
export const RetryPipelineJobSchema = PipelineJobControlSchema;
|
|
303
|
-
// Schema for canceling a job
|
|
301
|
+
// Schema for canceling a job
|
|
304
302
|
export const CancelPipelineJobSchema = z.object({
|
|
305
303
|
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
306
304
|
job_id: z.coerce.string().describe("The ID of the job"),
|
|
@@ -772,7 +770,8 @@ export const LineRangeSchema = z
|
|
|
772
770
|
})
|
|
773
771
|
.describe("Line range for multiline comments on GitLab merge request diffs. VALIDATION RULES: 1) line_code is critical for GitLab API success, 2) start/end must have consistent types, 3) line numbers must form valid range, 4) get line_code from GitLab diff API, never generate manually.");
|
|
774
772
|
// Discussion related schemas
|
|
775
|
-
export const GitLabDiscussionNoteSchema = z
|
|
773
|
+
export const GitLabDiscussionNoteSchema = z
|
|
774
|
+
.object({
|
|
776
775
|
id: z.coerce.string(),
|
|
777
776
|
type: z.enum(["DiscussionNote", "DiffNote", "Note"]).nullable().optional(), // Allow null type for regular notes
|
|
778
777
|
body: z.string().optional(),
|
|
@@ -816,7 +815,8 @@ export const GitLabDiscussionNoteSchema = z.object({
|
|
|
816
815
|
})
|
|
817
816
|
.passthrough() // Allow additional fields
|
|
818
817
|
.optional(),
|
|
819
|
-
})
|
|
818
|
+
})
|
|
819
|
+
.passthrough(); // Allow additional fields that GitLab might return
|
|
820
820
|
// Reusable pagination schema for GitLab API responses.
|
|
821
821
|
// See https://docs.gitlab.com/api/rest/#pagination
|
|
822
822
|
export const GitLabPaginationSchema = z.object({
|
|
@@ -855,7 +855,10 @@ export const ListMergeRequestDiscussionsSchema = ProjectParamsSchema.extend({
|
|
|
855
855
|
export const GetMergeRequestNotesSchema = ProjectParamsSchema.extend({
|
|
856
856
|
merge_request_iid: z.coerce.string().describe("The IID of a merge request"),
|
|
857
857
|
sort: z.enum(["asc", "desc"]).optional().describe("The sort order of the notes"),
|
|
858
|
-
order_by: z
|
|
858
|
+
order_by: z
|
|
859
|
+
.enum(["created_at", "updated_at"])
|
|
860
|
+
.optional()
|
|
861
|
+
.describe("The field to sort the notes by"),
|
|
859
862
|
per_page: z.coerce.number().optional().describe("Number of items per page"),
|
|
860
863
|
page: z.coerce.number().optional().describe("Page number for pagination"),
|
|
861
864
|
});
|
|
@@ -910,7 +913,14 @@ export const UpdateIssueNoteSchema = ProjectParamsSchema.extend({
|
|
|
910
913
|
issue_iid: z.coerce.string().describe("The IID of an issue"),
|
|
911
914
|
discussion_id: z.coerce.string().describe("The ID of a thread"),
|
|
912
915
|
note_id: z.coerce.string().describe("The ID of a thread note"),
|
|
913
|
-
body: z.string().describe("The content of the note or reply"),
|
|
916
|
+
body: z.string().optional().describe("The content of the note or reply"),
|
|
917
|
+
resolved: z.boolean().optional().describe("Resolve or unresolve the note"),
|
|
918
|
+
})
|
|
919
|
+
.refine(data => data.body !== undefined || data.resolved !== undefined, {
|
|
920
|
+
message: "At least one of 'body' or 'resolved' must be provided",
|
|
921
|
+
})
|
|
922
|
+
.refine(data => !(data.body !== undefined && data.resolved !== undefined), {
|
|
923
|
+
message: "Only one of 'body' or 'resolved' can be provided, not both",
|
|
914
924
|
});
|
|
915
925
|
// Input schema for adding a note to an existing issue discussion
|
|
916
926
|
export const CreateIssueNoteSchema = ProjectParamsSchema.extend({
|
|
@@ -963,7 +973,11 @@ export const CreateIssueSchema = ProjectParamsSchema.extend({
|
|
|
963
973
|
assignee_ids: z.array(z.number()).optional().describe("Array of user IDs to assign"),
|
|
964
974
|
labels: z.array(z.string()).optional().describe("Array of label names"),
|
|
965
975
|
milestone_id: z.coerce.string().optional().describe("Milestone ID to assign"),
|
|
966
|
-
issue_type: z
|
|
976
|
+
issue_type: z
|
|
977
|
+
.enum(["issue", "incident", "test_case", "task"])
|
|
978
|
+
.describe("the type of issue. One of issue, incident, test_case or task.")
|
|
979
|
+
.nullish()
|
|
980
|
+
.default("issue"),
|
|
967
981
|
});
|
|
968
982
|
const MergeRequestOptionsSchema = {
|
|
969
983
|
title: z.string().describe("Merge request title"),
|
|
@@ -979,10 +993,14 @@ const MergeRequestOptionsSchema = {
|
|
|
979
993
|
labels: z.array(z.string()).optional().describe("Labels for the MR"),
|
|
980
994
|
draft: z.boolean().optional().describe("Create as draft merge request"),
|
|
981
995
|
allow_collaboration: z.boolean().optional().describe("Allow commits from upstream members"),
|
|
982
|
-
remove_source_branch: z
|
|
996
|
+
remove_source_branch: z
|
|
997
|
+
.boolean()
|
|
998
|
+
.nullable()
|
|
983
999
|
.optional()
|
|
984
1000
|
.describe("Flag indicating if a merge request should remove the source branch when merging."),
|
|
985
|
-
squash: z
|
|
1001
|
+
squash: z
|
|
1002
|
+
.boolean()
|
|
1003
|
+
.nullable()
|
|
986
1004
|
.optional()
|
|
987
1005
|
.describe("If true, squash all commits into a single commit on merge."),
|
|
988
1006
|
};
|
|
@@ -999,7 +1017,8 @@ export const CreateBranchSchema = ProjectParamsSchema.extend({
|
|
|
999
1017
|
export const GetBranchDiffsSchema = ProjectParamsSchema.extend({
|
|
1000
1018
|
from: z.string().describe("The base branch or commit SHA to compare from"),
|
|
1001
1019
|
to: z.string().describe("The target branch or commit SHA to compare to"),
|
|
1002
|
-
straight: z
|
|
1020
|
+
straight: z
|
|
1021
|
+
.boolean()
|
|
1003
1022
|
.optional()
|
|
1004
1023
|
.describe("Comparison method: false for '...' (default), true for '--'"),
|
|
1005
1024
|
excluded_file_patterns: z
|
|
@@ -1034,18 +1053,40 @@ export const UpdateMergeRequestSchema = GetMergeRequestSchema.extend({
|
|
|
1034
1053
|
});
|
|
1035
1054
|
export const MergeMergeRequestSchema = ProjectParamsSchema.extend({
|
|
1036
1055
|
merge_request_iid: z.coerce.string().optional().describe("The IID of a merge request"),
|
|
1037
|
-
auto_merge: z
|
|
1056
|
+
auto_merge: z
|
|
1057
|
+
.boolean()
|
|
1058
|
+
.optional()
|
|
1059
|
+
.default(false)
|
|
1060
|
+
.describe("If true, the merge request merges when the pipeline succeeds."),
|
|
1038
1061
|
merge_commit_message: z.string().optional().describe("Custom merge commit message"),
|
|
1039
|
-
merge_when_pipeline_succeeds: z
|
|
1040
|
-
|
|
1062
|
+
merge_when_pipeline_succeeds: z
|
|
1063
|
+
.boolean()
|
|
1064
|
+
.optional()
|
|
1065
|
+
.default(false)
|
|
1066
|
+
.describe("If true, the merge request merges when the pipeline succeeds.in GitLab 17.11. Use"),
|
|
1067
|
+
should_remove_source_branch: z
|
|
1068
|
+
.boolean()
|
|
1069
|
+
.optional()
|
|
1070
|
+
.default(false)
|
|
1071
|
+
.describe("Remove source branch after merge"),
|
|
1041
1072
|
squash_commit_message: z.string().optional().describe("Custom squash commit message"),
|
|
1042
|
-
squash: z
|
|
1073
|
+
squash: z
|
|
1074
|
+
.boolean()
|
|
1075
|
+
.optional()
|
|
1076
|
+
.default(false)
|
|
1077
|
+
.describe("Squash commits into a single commit when merging"),
|
|
1043
1078
|
});
|
|
1044
1079
|
// Merge Request Approval schemas
|
|
1045
1080
|
export const ApproveMergeRequestSchema = ProjectParamsSchema.extend({
|
|
1046
1081
|
merge_request_iid: z.coerce.string().describe("The IID of the merge request to approve"),
|
|
1047
|
-
sha: z
|
|
1048
|
-
|
|
1082
|
+
sha: z
|
|
1083
|
+
.string()
|
|
1084
|
+
.optional()
|
|
1085
|
+
.describe("The HEAD of the merge request. Optional, but used to ensure the merge request hasn't changed since you last reviewed it"),
|
|
1086
|
+
approval_password: z
|
|
1087
|
+
.string()
|
|
1088
|
+
.optional()
|
|
1089
|
+
.describe("Current user's password. Required if 'Require user re-authentication to approve' is enabled in the project settings"),
|
|
1049
1090
|
});
|
|
1050
1091
|
export const UnapproveMergeRequestSchema = ProjectParamsSchema.extend({
|
|
1051
1092
|
merge_request_iid: z.coerce.string().describe("The IID of the merge request to unapprove"),
|
|
@@ -1066,21 +1107,26 @@ export const GitLabApprovalRuleSchema = z.object({
|
|
|
1066
1107
|
eligible_approvers: z.array(GitLabApprovalUserSchema).optional(),
|
|
1067
1108
|
approvals_required: z.number(),
|
|
1068
1109
|
users: z.array(GitLabApprovalUserSchema).optional(),
|
|
1069
|
-
groups: z
|
|
1110
|
+
groups: z
|
|
1111
|
+
.array(z.object({
|
|
1070
1112
|
id: z.coerce.string(),
|
|
1071
1113
|
name: z.string(),
|
|
1072
1114
|
path: z.string(),
|
|
1073
1115
|
full_path: z.string(),
|
|
1074
1116
|
avatar_url: z.string().nullable().optional(),
|
|
1075
1117
|
web_url: z.string(),
|
|
1076
|
-
}))
|
|
1118
|
+
}))
|
|
1119
|
+
.optional(),
|
|
1077
1120
|
contains_hidden_groups: z.boolean().optional(),
|
|
1078
1121
|
approved_by: z.array(GitLabApprovalUserSchema).optional(),
|
|
1079
|
-
source_rule: z
|
|
1122
|
+
source_rule: z
|
|
1123
|
+
.object({
|
|
1080
1124
|
id: z.coerce.string().optional(),
|
|
1081
1125
|
name: z.string().optional(),
|
|
1082
1126
|
rule_type: z.string().optional(),
|
|
1083
|
-
})
|
|
1127
|
+
})
|
|
1128
|
+
.nullable()
|
|
1129
|
+
.optional(),
|
|
1084
1130
|
approved: z.boolean().optional(),
|
|
1085
1131
|
});
|
|
1086
1132
|
export const GitLabMergeRequestApprovalStateSchema = z.object({
|
|
@@ -1100,7 +1146,8 @@ export const GetMergeRequestDiffsSchema = GetMergeRequestSchema.extend({
|
|
|
1100
1146
|
export const ListMergeRequestDiffsSchema = GetMergeRequestSchema.extend({
|
|
1101
1147
|
page: z.number().optional().describe("Page number for pagination (default: 1)"),
|
|
1102
1148
|
per_page: z.number().optional().describe("Number of items per page (max: 100, default: 20)"),
|
|
1103
|
-
unidiff: z
|
|
1149
|
+
unidiff: z
|
|
1150
|
+
.boolean()
|
|
1104
1151
|
.optional()
|
|
1105
1152
|
.describe("Present diffs in the unified diff format. Default is false. Introduced in GitLab 16.5."),
|
|
1106
1153
|
});
|
|
@@ -1110,7 +1157,8 @@ export const ListMergeRequestVersionsSchema = ProjectParamsSchema.extend({
|
|
|
1110
1157
|
});
|
|
1111
1158
|
export const GetMergeRequestVersionSchema = ListMergeRequestVersionsSchema.extend({
|
|
1112
1159
|
version_id: z.coerce.string().describe("The ID of the merge request diff version"),
|
|
1113
|
-
unidiff: z
|
|
1160
|
+
unidiff: z
|
|
1161
|
+
.boolean()
|
|
1114
1162
|
.optional()
|
|
1115
1163
|
.describe("Present diffs in the unified diff format. Default is false. Introduced in GitLab 16.5."),
|
|
1116
1164
|
});
|
|
@@ -1170,7 +1218,10 @@ export const ListIssuesSchema = z
|
|
|
1170
1218
|
// Merge Requests API operation schemas
|
|
1171
1219
|
export const ListMergeRequestsSchema = z
|
|
1172
1220
|
.object({
|
|
1173
|
-
project_id: z.coerce
|
|
1221
|
+
project_id: z.coerce
|
|
1222
|
+
.string()
|
|
1223
|
+
.optional()
|
|
1224
|
+
.describe("Project ID or URL-encoded path (optional - if not provided, lists all merge requests the user has access to)"),
|
|
1174
1225
|
assignee_id: z.coerce
|
|
1175
1226
|
.string()
|
|
1176
1227
|
.optional()
|
|
@@ -1269,7 +1320,9 @@ export const UpdateIssueSchema = z.object({
|
|
|
1269
1320
|
milestone_id: z.coerce.string().optional().describe("Milestone ID to assign"),
|
|
1270
1321
|
state_event: z.enum(["close", "reopen"]).optional().describe("Update issue state (close/reopen)"),
|
|
1271
1322
|
weight: z.number().optional().describe("Weight of the issue (0-9)"),
|
|
1272
|
-
issue_type: z
|
|
1323
|
+
issue_type: z
|
|
1324
|
+
.enum(["issue", "incident", "test_case", "task"])
|
|
1325
|
+
.describe("the type of issue. One of issue, incident, test_case or task."),
|
|
1273
1326
|
});
|
|
1274
1327
|
export const DeleteIssueSchema = z.object({
|
|
1275
1328
|
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
@@ -1325,11 +1378,10 @@ export const GetProjectSchema = z.object({
|
|
|
1325
1378
|
export const ListProjectsSchema = z
|
|
1326
1379
|
.object({
|
|
1327
1380
|
search: z.string().optional().describe("Search term for projects"),
|
|
1328
|
-
search_namespaces: z.boolean()
|
|
1329
|
-
.optional()
|
|
1330
|
-
.describe("Needs to be true if search is full path"),
|
|
1381
|
+
search_namespaces: z.boolean().optional().describe("Needs to be true if search is full path"),
|
|
1331
1382
|
owned: z.boolean().optional().describe("Filter for projects owned by current user"),
|
|
1332
|
-
membership: z
|
|
1383
|
+
membership: z
|
|
1384
|
+
.boolean()
|
|
1333
1385
|
.optional()
|
|
1334
1386
|
.describe("Filter for projects where current user is a member"),
|
|
1335
1387
|
simple: z.boolean().optional().describe("Return only limited fields"),
|
|
@@ -1469,19 +1521,57 @@ export const GitLabWikiPageSchema = z.object({
|
|
|
1469
1521
|
// Extremely flexible position schema for API responses - accepts any structure
|
|
1470
1522
|
// Strict position schema for creating draft notes and merge request threads
|
|
1471
1523
|
export const MergeRequestThreadPositionCreateSchema = z.object({
|
|
1472
|
-
base_sha: z
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1524
|
+
base_sha: z
|
|
1525
|
+
.string()
|
|
1526
|
+
.describe("REQUIRED: Base commit SHA in the source branch. Get this from merge request diff_refs.base_sha."),
|
|
1527
|
+
head_sha: z
|
|
1528
|
+
.string()
|
|
1529
|
+
.describe("REQUIRED: SHA referencing HEAD of the source branch. Get this from merge request diff_refs.head_sha."),
|
|
1530
|
+
start_sha: z
|
|
1531
|
+
.string()
|
|
1532
|
+
.describe("REQUIRED: SHA referencing the start commit of the source branch. Get this from merge request diff_refs.start_sha."),
|
|
1533
|
+
position_type: z
|
|
1534
|
+
.enum(["text", "image", "file"])
|
|
1535
|
+
.describe("REQUIRED: Position type. Use 'text' for code diffs, 'image' for image diffs, 'file' for file-level comments."),
|
|
1536
|
+
new_path: z
|
|
1537
|
+
.string()
|
|
1538
|
+
.nullable()
|
|
1539
|
+
.optional()
|
|
1540
|
+
.describe("File path after changes. REQUIRED for most diff comments. Use same as old_path if file wasn't renamed."),
|
|
1541
|
+
old_path: z
|
|
1542
|
+
.string()
|
|
1543
|
+
.nullable()
|
|
1544
|
+
.optional()
|
|
1545
|
+
.describe("File path before changes. REQUIRED for most diff comments. Use same as new_path if file wasn't renamed."),
|
|
1546
|
+
new_line: z
|
|
1547
|
+
.number()
|
|
1548
|
+
.nullable()
|
|
1549
|
+
.optional()
|
|
1550
|
+
.describe("Line number in modified file (after changes). Use for added lines or context lines. NULL for deleted lines. For single-line comments on new lines."),
|
|
1551
|
+
old_line: z
|
|
1552
|
+
.number()
|
|
1553
|
+
.nullable()
|
|
1554
|
+
.optional()
|
|
1555
|
+
.describe("Line number in original file (before changes). Use for deleted lines or context lines. NULL for added lines. For single-line comments on old lines."),
|
|
1556
|
+
line_range: LineRangeSchema.nullable()
|
|
1557
|
+
.optional()
|
|
1558
|
+
.describe("MULTILINE COMMENTS: Specify start/end line positions for commenting on multiple lines. Alternative to single old_line/new_line."),
|
|
1559
|
+
width: z
|
|
1560
|
+
.number()
|
|
1561
|
+
.optional()
|
|
1562
|
+
.describe("IMAGE DIFFS ONLY: Width of the image (for position_type='image')."),
|
|
1563
|
+
height: z
|
|
1564
|
+
.number()
|
|
1565
|
+
.optional()
|
|
1566
|
+
.describe("IMAGE DIFFS ONLY: Height of the image (for position_type='image')."),
|
|
1567
|
+
x: z
|
|
1568
|
+
.number()
|
|
1569
|
+
.optional()
|
|
1570
|
+
.describe("IMAGE DIFFS ONLY: X coordinate on the image (for position_type='image')."),
|
|
1571
|
+
y: z
|
|
1572
|
+
.number()
|
|
1573
|
+
.optional()
|
|
1574
|
+
.describe("IMAGE DIFFS ONLY: Y coordinate on the image (for position_type='image')."),
|
|
1485
1575
|
});
|
|
1486
1576
|
// Schema for creating/sending position to GitLab API (stricter)
|
|
1487
1577
|
export const MergeRequestThreadPositionSchema = z.object({
|
|
@@ -1517,7 +1607,9 @@ export const MergeRequestThreadPositionSchema = z.object({
|
|
|
1517
1607
|
.nullable()
|
|
1518
1608
|
.optional()
|
|
1519
1609
|
.describe("Line number in original file (before changes). Use for deleted lines or context lines. NULL for added lines. For single-line comments on old lines."),
|
|
1520
|
-
line_range: LineRangeSchema.nullable()
|
|
1610
|
+
line_range: LineRangeSchema.nullable()
|
|
1611
|
+
.optional()
|
|
1612
|
+
.describe("MULTILINE COMMENTS: Specify start/end line positions for commenting on multiple lines. Alternative to single old_line/new_line."),
|
|
1521
1613
|
width: z
|
|
1522
1614
|
.number()
|
|
1523
1615
|
.nullable()
|
|
@@ -1540,22 +1632,26 @@ export const MergeRequestThreadPositionSchema = z.object({
|
|
|
1540
1632
|
.describe("IMAGE DIFFS ONLY: Y coordinate on the image (for position_type='image')."),
|
|
1541
1633
|
});
|
|
1542
1634
|
// Draft Notes API schemas
|
|
1543
|
-
export const GitLabDraftNoteSchema = z
|
|
1635
|
+
export const GitLabDraftNoteSchema = z
|
|
1636
|
+
.object({
|
|
1544
1637
|
id: z.coerce.string(),
|
|
1545
1638
|
author: GitLabUserSchema.optional(),
|
|
1546
1639
|
body: z.string().optional(),
|
|
1547
1640
|
note: z.string().optional(), // Some APIs might use 'note' instead of 'body'
|
|
1548
1641
|
created_at: z.string().optional(),
|
|
1549
1642
|
updated_at: z.string().optional(),
|
|
1550
|
-
|
|
1643
|
+
discussion_id: z.string().nullable().optional(),
|
|
1644
|
+
position: z.record(z.unknown()).nullable().optional(),
|
|
1551
1645
|
resolve_discussion: z.boolean().optional(),
|
|
1552
|
-
})
|
|
1646
|
+
})
|
|
1647
|
+
.transform(data => ({
|
|
1553
1648
|
// Normalize the response to always have consistent field names
|
|
1554
1649
|
id: data.id,
|
|
1555
1650
|
author: data.author,
|
|
1556
1651
|
body: data.body || data.note || "",
|
|
1557
1652
|
created_at: data.created_at || "",
|
|
1558
1653
|
updated_at: data.updated_at || "",
|
|
1654
|
+
discussion_id: data.discussion_id || null,
|
|
1559
1655
|
position: data.position,
|
|
1560
1656
|
resolve_discussion: data.resolve_discussion,
|
|
1561
1657
|
}));
|
|
@@ -1572,8 +1668,15 @@ export const ListDraftNotesSchema = ProjectParamsSchema.extend({
|
|
|
1572
1668
|
export const CreateDraftNoteSchema = ProjectParamsSchema.extend({
|
|
1573
1669
|
merge_request_iid: z.coerce.string().describe("The IID of a merge request"),
|
|
1574
1670
|
body: z.string().describe("The content of the draft note"),
|
|
1671
|
+
in_reply_to_discussion_id: z.coerce
|
|
1672
|
+
.string()
|
|
1673
|
+
.optional()
|
|
1674
|
+
.describe("The ID of a discussion the draft note replies to"),
|
|
1575
1675
|
position: MergeRequestThreadPositionSchema.optional().describe("Position when creating a diff note"),
|
|
1576
|
-
resolve_discussion: z
|
|
1676
|
+
resolve_discussion: z
|
|
1677
|
+
.boolean()
|
|
1678
|
+
.optional()
|
|
1679
|
+
.describe("Whether to resolve the discussion when publishing"),
|
|
1577
1680
|
});
|
|
1578
1681
|
// Update draft note schema
|
|
1579
1682
|
export const UpdateDraftNoteSchema = ProjectParamsSchema.extend({
|
|
@@ -1581,7 +1684,10 @@ export const UpdateDraftNoteSchema = ProjectParamsSchema.extend({
|
|
|
1581
1684
|
draft_note_id: z.coerce.string().describe("The ID of the draft note"),
|
|
1582
1685
|
body: z.string().optional().describe("The content of the draft note"),
|
|
1583
1686
|
position: MergeRequestThreadPositionSchema.optional().describe("Position when creating a diff note"),
|
|
1584
|
-
resolve_discussion: z
|
|
1687
|
+
resolve_discussion: z
|
|
1688
|
+
.boolean()
|
|
1689
|
+
.optional()
|
|
1690
|
+
.describe("Whether to resolve the discussion when publishing"),
|
|
1585
1691
|
});
|
|
1586
1692
|
// Delete draft note schema
|
|
1587
1693
|
export const DeleteDraftNoteSchema = ProjectParamsSchema.extend({
|
|
@@ -1685,10 +1791,9 @@ export const ListCommitsSchema = z.object({
|
|
|
1685
1791
|
path: z.string().optional().describe("The file path"),
|
|
1686
1792
|
author: z.string().optional().describe("Search commits by commit author"),
|
|
1687
1793
|
all: z.boolean().optional().describe("Retrieve every commit from the repository"),
|
|
1688
|
-
with_stats: z.boolean()
|
|
1689
|
-
|
|
1690
|
-
.
|
|
1691
|
-
first_parent: z.boolean()
|
|
1794
|
+
with_stats: z.boolean().optional().describe("Stats about each commit are added to the response"),
|
|
1795
|
+
first_parent: z
|
|
1796
|
+
.boolean()
|
|
1692
1797
|
.optional()
|
|
1693
1798
|
.describe("Follow only the first parent commit upon seeing a merge commit"),
|
|
1694
1799
|
order: z.enum(["default", "topo"]).optional().describe("List commits in order"),
|
|
@@ -1704,11 +1809,17 @@ export const GetCommitSchema = z.object({
|
|
|
1704
1809
|
export const GetCommitDiffSchema = z.object({
|
|
1705
1810
|
project_id: z.coerce.string().describe("Project ID or complete URL-encoded path to project"),
|
|
1706
1811
|
sha: z.string().describe("The commit hash or name of a repository branch or tag"),
|
|
1707
|
-
full_diff: z
|
|
1812
|
+
full_diff: z
|
|
1813
|
+
.boolean()
|
|
1814
|
+
.optional()
|
|
1815
|
+
.describe("Whether to return the full diff or only first page (default: false)"),
|
|
1708
1816
|
});
|
|
1709
1817
|
// Schema for listing issues assigned to the current user
|
|
1710
1818
|
export const MyIssuesSchema = z.object({
|
|
1711
|
-
project_id: z
|
|
1819
|
+
project_id: z
|
|
1820
|
+
.string()
|
|
1821
|
+
.optional()
|
|
1822
|
+
.describe("Project ID or URL-encoded path (optional when GITLAB_PROJECT_ID is set)"),
|
|
1712
1823
|
state: z
|
|
1713
1824
|
.enum(["opened", "closed", "all"])
|
|
1714
1825
|
.optional()
|
|
@@ -1716,10 +1827,22 @@ export const MyIssuesSchema = z.object({
|
|
|
1716
1827
|
labels: z.array(z.string()).optional().describe("Array of label names to filter by"),
|
|
1717
1828
|
milestone: z.string().optional().describe("Milestone title to filter by"),
|
|
1718
1829
|
search: z.string().optional().describe("Search for specific terms in title and description"),
|
|
1719
|
-
created_after: z
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1830
|
+
created_after: z
|
|
1831
|
+
.string()
|
|
1832
|
+
.optional()
|
|
1833
|
+
.describe("Return issues created after the given time (ISO 8601)"),
|
|
1834
|
+
created_before: z
|
|
1835
|
+
.string()
|
|
1836
|
+
.optional()
|
|
1837
|
+
.describe("Return issues created before the given time (ISO 8601)"),
|
|
1838
|
+
updated_after: z
|
|
1839
|
+
.string()
|
|
1840
|
+
.optional()
|
|
1841
|
+
.describe("Return issues updated after the given time (ISO 8601)"),
|
|
1842
|
+
updated_before: z
|
|
1843
|
+
.string()
|
|
1844
|
+
.optional()
|
|
1845
|
+
.describe("Return issues updated before the given time (ISO 8601)"),
|
|
1723
1846
|
per_page: z.number().optional().describe("Number of items per page (default: 20, max: 100)"),
|
|
1724
1847
|
page: z.number().optional().describe("Page number for pagination (default: 1)"),
|
|
1725
1848
|
});
|
|
@@ -1766,7 +1889,10 @@ export const DownloadAttachmentSchema = z.object({
|
|
|
1766
1889
|
project_id: z.string().describe("Project ID or URL-encoded path of the project"),
|
|
1767
1890
|
secret: z.string().describe("The 32-character secret of the upload"),
|
|
1768
1891
|
filename: z.string().describe("The filename of the upload"),
|
|
1769
|
-
local_path: z
|
|
1892
|
+
local_path: z
|
|
1893
|
+
.string()
|
|
1894
|
+
.optional()
|
|
1895
|
+
.describe("Local path to save the file (optional, defaults to current directory)"),
|
|
1770
1896
|
});
|
|
1771
1897
|
export const GroupIteration = z.object({
|
|
1772
1898
|
id: z.coerce.string(),
|
|
@@ -1797,10 +1923,12 @@ export const ListGroupIterationsSchema = z
|
|
|
1797
1923
|
.array(z.enum(["title", "cadence_title"]))
|
|
1798
1924
|
.optional()
|
|
1799
1925
|
.describe("Fields in which fuzzy search should be performed with the query given in the argument search. The available options are title and cadence_title. Default is [title]."),
|
|
1800
|
-
include_ancestors: z
|
|
1926
|
+
include_ancestors: z
|
|
1927
|
+
.boolean()
|
|
1801
1928
|
.optional()
|
|
1802
1929
|
.describe("Include iterations for group and its ancestors. Defaults to true."),
|
|
1803
|
-
include_descendants: z
|
|
1930
|
+
include_descendants: z
|
|
1931
|
+
.boolean()
|
|
1804
1932
|
.optional()
|
|
1805
1933
|
.describe("Include iterations for group and its descendants. Defaults to false."),
|
|
1806
1934
|
updated_before: z
|
|
@@ -1822,7 +1950,8 @@ export const GitLabEventAuthorSchema = z.object({
|
|
|
1822
1950
|
avatar_url: z.string().nullable(),
|
|
1823
1951
|
web_url: z.string(),
|
|
1824
1952
|
});
|
|
1825
|
-
export const GitLabEventSchema = z
|
|
1953
|
+
export const GitLabEventSchema = z
|
|
1954
|
+
.object({
|
|
1826
1955
|
id: z.coerce.string(),
|
|
1827
1956
|
project_id: z.coerce.string(),
|
|
1828
1957
|
action_name: z.string(),
|
|
@@ -1836,26 +1965,57 @@ export const GitLabEventSchema = z.object({
|
|
|
1836
1965
|
author_username: z.string(),
|
|
1837
1966
|
imported: z.boolean(),
|
|
1838
1967
|
imported_from: z.string(),
|
|
1839
|
-
})
|
|
1968
|
+
})
|
|
1969
|
+
.passthrough(); // Allow additional fields
|
|
1840
1970
|
// List events schema
|
|
1841
1971
|
export const ListEventsSchema = z.object({
|
|
1842
|
-
action: z
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1972
|
+
action: z
|
|
1973
|
+
.string()
|
|
1974
|
+
.optional()
|
|
1975
|
+
.describe("If defined, returns events with the specified action type"),
|
|
1976
|
+
target_type: z
|
|
1977
|
+
.enum(["epic", "issue", "merge_request", "milestone", "note", "project", "snippet", "user"])
|
|
1978
|
+
.optional()
|
|
1979
|
+
.describe("If defined, returns events with the specified target type"),
|
|
1980
|
+
before: z
|
|
1981
|
+
.string()
|
|
1982
|
+
.optional()
|
|
1983
|
+
.describe("If defined, Returns events created before the specified date (YYYY-MM-DD format). To include events on 2025-08-29, use before=2025-08-30"),
|
|
1984
|
+
after: z
|
|
1985
|
+
.string()
|
|
1986
|
+
.optional()
|
|
1987
|
+
.describe("If defined, Returns events created after the specified date (YYYY-MM-DD format). To include events on 2025-08-29, use after=2025-08-28"),
|
|
1846
1988
|
scope: z.string().optional().describe("Include all events across a user's projects"),
|
|
1847
|
-
sort: z
|
|
1989
|
+
sort: z
|
|
1990
|
+
.enum(["asc", "desc"])
|
|
1991
|
+
.optional()
|
|
1992
|
+
.describe("Direction to sort the results by creation date. Default: desc"),
|
|
1848
1993
|
page: z.number().optional().describe("Returns the specified results page. Default: 1"),
|
|
1849
1994
|
per_page: z.number().optional().describe("Number of results per page. Default: 20"),
|
|
1850
1995
|
});
|
|
1851
1996
|
// Get project events schema
|
|
1852
1997
|
export const GetProjectEventsSchema = z.object({
|
|
1853
1998
|
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
1854
|
-
action: z
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1999
|
+
action: z
|
|
2000
|
+
.string()
|
|
2001
|
+
.optional()
|
|
2002
|
+
.describe("If defined, returns events with the specified action type"),
|
|
2003
|
+
target_type: z
|
|
2004
|
+
.enum(["epic", "issue", "merge_request", "milestone", "note", "project", "snippet", "user"])
|
|
2005
|
+
.optional()
|
|
2006
|
+
.describe("If defined, returns events with the specified target type"),
|
|
2007
|
+
before: z
|
|
2008
|
+
.string()
|
|
2009
|
+
.optional()
|
|
2010
|
+
.describe("If defined, Returns events created before the specified date (YYYY-MM-DD format). To include events on 2025-08-29, use before=2025-08-30"),
|
|
2011
|
+
after: z
|
|
2012
|
+
.string()
|
|
2013
|
+
.optional()
|
|
2014
|
+
.describe("If defined, Returns events created after the specified date (YYYY-MM-DD format). To include events on 2025-08-29, use after=2025-08-28"),
|
|
2015
|
+
sort: z
|
|
2016
|
+
.enum(["asc", "desc"])
|
|
2017
|
+
.optional()
|
|
2018
|
+
.describe("Direction to sort the results by creation date. Default: desc"),
|
|
1859
2019
|
page: z.number().optional().describe("Returns the specified results page. Default: 1"),
|
|
1860
2020
|
per_page: z.number().optional().describe("Number of results per page. Default: 20"),
|
|
1861
2021
|
});
|
|
@@ -1878,10 +2038,7 @@ export const GitLabMergeRequestVersionDetailSchema = GitLabMergeRequestVersionSc
|
|
|
1878
2038
|
// GraphQL generic execution schema
|
|
1879
2039
|
export const ExecuteGraphQLSchema = z.object({
|
|
1880
2040
|
query: z.string().describe("GraphQL query string"),
|
|
1881
|
-
variables: z
|
|
1882
|
-
.record(z.any())
|
|
1883
|
-
.optional()
|
|
1884
|
-
.describe("Variables object for the GraphQL query"),
|
|
2041
|
+
variables: z.record(z.any()).optional().describe("Variables object for the GraphQL query"),
|
|
1885
2042
|
});
|
|
1886
2043
|
// Release schemas
|
|
1887
2044
|
export const GitLabReleaseAssetLinkSchema = z.object({
|
|
@@ -1913,15 +2070,18 @@ export const GitLabReleaseSchema = z.object({
|
|
|
1913
2070
|
description_html: z.string().nullable().optional(),
|
|
1914
2071
|
created_at: z.string(),
|
|
1915
2072
|
released_at: z.string().nullable().optional(),
|
|
1916
|
-
author: z
|
|
2073
|
+
author: z
|
|
2074
|
+
.object({
|
|
1917
2075
|
id: z.number(),
|
|
1918
2076
|
name: z.string(),
|
|
1919
2077
|
username: z.string(),
|
|
1920
2078
|
state: z.string(),
|
|
1921
2079
|
avatar_url: z.string().nullable().optional(),
|
|
1922
2080
|
web_url: z.string(),
|
|
1923
|
-
})
|
|
1924
|
-
|
|
2081
|
+
})
|
|
2082
|
+
.optional(),
|
|
2083
|
+
commit: z
|
|
2084
|
+
.object({
|
|
1925
2085
|
id: z.string(),
|
|
1926
2086
|
short_id: z.string(),
|
|
1927
2087
|
title: z.string(),
|
|
@@ -1934,13 +2094,15 @@ export const GitLabReleaseSchema = z.object({
|
|
|
1934
2094
|
committer_name: z.string(),
|
|
1935
2095
|
committer_email: z.string(),
|
|
1936
2096
|
committed_date: z.string(),
|
|
1937
|
-
})
|
|
2097
|
+
})
|
|
2098
|
+
.optional(),
|
|
1938
2099
|
milestones: z.array(GitLabMilestonesSchema).optional(),
|
|
1939
2100
|
commit_path: z.string().optional(),
|
|
1940
2101
|
tag_path: z.string().optional(),
|
|
1941
2102
|
assets: GitLabReleaseAssetsSchema.optional(),
|
|
1942
2103
|
evidences: z.array(GitLabReleaseEvidenceSchema).optional(),
|
|
1943
|
-
_links: z
|
|
2104
|
+
_links: z
|
|
2105
|
+
.object({
|
|
1944
2106
|
closed_issues_url: z.string().optional(),
|
|
1945
2107
|
closed_merge_requests_url: z.string().optional(),
|
|
1946
2108
|
edit_url: z.string().optional(),
|
|
@@ -1948,7 +2110,8 @@ export const GitLabReleaseSchema = z.object({
|
|
|
1948
2110
|
opened_issues_url: z.string().optional(),
|
|
1949
2111
|
opened_merge_requests_url: z.string().optional(),
|
|
1950
2112
|
self: z.string().optional(),
|
|
1951
|
-
})
|
|
2113
|
+
})
|
|
2114
|
+
.optional(),
|
|
1952
2115
|
upcoming_release: z.boolean().optional(),
|
|
1953
2116
|
historical_release: z.boolean().optional(),
|
|
1954
2117
|
});
|
|
@@ -1982,7 +2145,10 @@ export const CreateReleaseSchema = z.object({
|
|
|
1982
2145
|
tag_name: z.string().describe("The tag where the release is created from"),
|
|
1983
2146
|
name: z.string().optional().describe("The release name"),
|
|
1984
2147
|
tag_message: z.string().optional().describe("Message to use if creating a new annotated tag"),
|
|
1985
|
-
description: z
|
|
2148
|
+
description: z
|
|
2149
|
+
.string()
|
|
2150
|
+
.optional()
|
|
2151
|
+
.describe("The description of the release. You can use Markdown."),
|
|
1986
2152
|
ref: z
|
|
1987
2153
|
.string()
|
|
1988
2154
|
.optional()
|
|
@@ -1995,9 +2161,16 @@ export const CreateReleaseSchema = z.object({
|
|
|
1995
2161
|
.object({
|
|
1996
2162
|
links: z
|
|
1997
2163
|
.array(z.object({
|
|
1998
|
-
name: z
|
|
1999
|
-
|
|
2000
|
-
|
|
2164
|
+
name: z
|
|
2165
|
+
.string()
|
|
2166
|
+
.describe("The name of the link. Link names must be unique within the release."),
|
|
2167
|
+
url: z
|
|
2168
|
+
.string()
|
|
2169
|
+
.describe("The URL of the link. Link URLs must be unique within the release."),
|
|
2170
|
+
direct_asset_path: z
|
|
2171
|
+
.string()
|
|
2172
|
+
.optional()
|
|
2173
|
+
.describe("Optional path for a direct asset link."),
|
|
2001
2174
|
link_type: z
|
|
2002
2175
|
.enum(["other", "runbook", "image", "package"])
|
|
2003
2176
|
.optional()
|
|
@@ -2016,7 +2189,10 @@ export const UpdateReleaseSchema = z.object({
|
|
|
2016
2189
|
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
2017
2190
|
tag_name: z.string().describe("The Git tag the release is associated with"),
|
|
2018
2191
|
name: z.string().optional().describe("The release name"),
|
|
2019
|
-
description: z
|
|
2192
|
+
description: z
|
|
2193
|
+
.string()
|
|
2194
|
+
.optional()
|
|
2195
|
+
.describe("The description of the release. You can use Markdown."),
|
|
2020
2196
|
milestones: z
|
|
2021
2197
|
.array(z.string())
|
|
2022
2198
|
.optional()
|
|
@@ -2037,5 +2213,7 @@ export const CreateReleaseEvidenceSchema = z.object({
|
|
|
2037
2213
|
export const DownloadReleaseAssetSchema = z.object({
|
|
2038
2214
|
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
2039
2215
|
tag_name: z.string().describe("The Git tag the release is associated with"),
|
|
2040
|
-
direct_asset_path: z
|
|
2216
|
+
direct_asset_path: z
|
|
2217
|
+
.string()
|
|
2218
|
+
.describe("Path to the release asset file as specified when creating or updating its link"),
|
|
2041
2219
|
});
|