@zereight/mcp-gitlab 2.0.4 → 2.0.5
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 +23 -18
- package/build/index.js +195 -2
- package/build/schemas.js +71 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,7 @@ docker run -i --rm \
|
|
|
171
171
|
- `GITLAB_DENIED_TOOLS_REGEX`: When set as a regular expression, it excludes the matching tools.
|
|
172
172
|
- `USE_GITLAB_WIKI`: When set to 'true', enables the wiki-related tools (list_wiki_pages, get_wiki_page, create_wiki_page, update_wiki_page, delete_wiki_page). By default, wiki features are disabled.
|
|
173
173
|
- `USE_MILESTONE`: When set to 'true', enables the milestone-related tools (list_milestones, get_milestone, create_milestone, edit_milestone, delete_milestone, get_milestone_issue, get_milestone_merge_requests, promote_milestone, get_milestone_burndown_events). By default, milestone features are disabled.
|
|
174
|
-
- `USE_PIPELINE`: When set to 'true', enables the pipeline-related tools (list_pipelines, get_pipeline, list_pipeline_jobs, get_pipeline_job, get_pipeline_job_output, create_pipeline, retry_pipeline, cancel_pipeline). By default, pipeline features are disabled.
|
|
174
|
+
- `USE_PIPELINE`: When set to 'true', enables the pipeline-related tools (list_pipelines, get_pipeline, list_pipeline_jobs, list_pipeline_trigger_jobs, get_pipeline_job, get_pipeline_job_output, create_pipeline, retry_pipeline, cancel_pipeline, play_pipeline_job, retry_pipeline_job, cancel_pipeline_job). By default, pipeline features are disabled.
|
|
175
175
|
- `GITLAB_AUTH_COOKIE_PATH`: Path to an authentication cookie file for GitLab instances that require cookie-based authentication. When provided, the cookie will be included in all GitLab API requests.
|
|
176
176
|
- `SSE`: When set to 'true', enables the Server-Sent Events transport.
|
|
177
177
|
- `STREAMABLE_HTTP`: When set to 'true', enables the Streamable HTTP transport. If both **SSE** and **STREAMABLE_HTTP** are set to 'true', the server will prioritize Streamable HTTP over SSE transport.
|
|
@@ -249,23 +249,28 @@ docker run -i --rm \
|
|
|
249
249
|
64. `create_pipeline` - Create a new pipeline for a branch or tag
|
|
250
250
|
65. `retry_pipeline` - Retry a failed or canceled pipeline
|
|
251
251
|
66. `cancel_pipeline` - Cancel a running pipeline
|
|
252
|
-
67. `
|
|
253
|
-
68. `
|
|
254
|
-
69. `
|
|
255
|
-
70. `
|
|
256
|
-
71. `
|
|
257
|
-
72. `
|
|
258
|
-
73. `
|
|
259
|
-
74. `
|
|
260
|
-
75. `
|
|
261
|
-
76. `
|
|
262
|
-
77. `
|
|
263
|
-
78. `
|
|
264
|
-
79. `
|
|
265
|
-
80. `
|
|
266
|
-
81. `
|
|
267
|
-
82. `
|
|
268
|
-
83. `
|
|
252
|
+
67. `play_pipeline_job` - Run a manual pipeline job
|
|
253
|
+
68. `retry_pipeline_job` - Retry a failed or canceled pipeline job
|
|
254
|
+
69. `cancel_pipeline_job` - Cancel a running pipeline job
|
|
255
|
+
70. `list_merge_requests` - List merge requests in a GitLab project with filtering options
|
|
256
|
+
71. `list_milestones` - List milestones in a GitLab project with filtering options
|
|
257
|
+
72. `get_milestone` - Get details of a specific milestone
|
|
258
|
+
73. `create_milestone` - Create a new milestone in a GitLab project
|
|
259
|
+
74. `edit_milestone` - Edit an existing milestone in a GitLab project
|
|
260
|
+
75. `delete_milestone` - Delete a milestone from a GitLab project
|
|
261
|
+
76. `get_milestone_issue` - Get issues associated with a specific milestone
|
|
262
|
+
77. `get_milestone_merge_requests` - Get merge requests associated with a specific milestone
|
|
263
|
+
78. `promote_milestone` - Promote a milestone to the next stage
|
|
264
|
+
79. `get_milestone_burndown_events` - Get burndown events for a specific milestone
|
|
265
|
+
80. `get_users` - Get GitLab user details by usernames
|
|
266
|
+
81. `list_commits` - List repository commits with filtering options
|
|
267
|
+
82. `get_commit` - Get details of a specific commit
|
|
268
|
+
83. `get_commit_diff` - Get changes/diffs of a specific commit
|
|
269
|
+
84. `list_group_iterations` - List group iterations with filtering options
|
|
270
|
+
85. `upload_markdown` - Upload a file to a GitLab project for use in markdown content
|
|
271
|
+
86. `download_attachment` - Download an uploaded file from a GitLab project by secret and filename
|
|
272
|
+
87. `list_events` - List all events for the currently authenticated user
|
|
273
|
+
88. `get_project_events` - List all visible events for a specified project
|
|
269
274
|
<!-- TOOLS-END -->
|
|
270
275
|
|
|
271
276
|
</details>
|
package/build/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
20
20
|
import { Agent } from "http";
|
|
21
21
|
import { Agent as HttpsAgent } from "https";
|
|
22
22
|
import { URL } from "url";
|
|
23
|
-
import { BulkPublishDraftNotesSchema, CancelPipelineSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateLabelSchema, // Added
|
|
23
|
+
import { BulkPublishDraftNotesSchema, CancelPipelineJobSchema, CancelPipelineSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateLabelSchema, // Added
|
|
24
24
|
CreateMergeRequestNoteSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateRepositorySchema, CreateWikiPageSchema, DeleteDraftNoteSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteLabelSchema, DeleteProjectMilestoneSchema, DeleteWikiPageSchema, EditProjectMilestoneSchema, ForkRepositorySchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetDraftNoteSchema, GetFileContentsSchema, GetIssueLinkSchema, GetIssueSchema, GetLabelSchema, GetMergeRequestDiffsSchema, GetMergeRequestSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetNamespaceSchema,
|
|
25
25
|
// pipeline job schemas
|
|
26
26
|
GetPipelineJobOutputSchema, GetPipelineSchema, GetProjectMilestoneSchema, GetProjectSchema, GetRepositoryTreeSchema, GetUsersSchema, GetWikiPageSchema, GitLabCommitSchema, GitLabCompareResultSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabDiffSchema,
|
|
@@ -29,7 +29,7 @@ GitLabDiscussionNoteSchema, // Added
|
|
|
29
29
|
GitLabDiscussionSchema,
|
|
30
30
|
// Draft Notes Schemas
|
|
31
31
|
GitLabDraftNoteSchema, GitLabForkSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestSchema, GitLabMilestonesSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabPipelineSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabSearchResponseSchema, GitLabTreeItemSchema, GitLabTreeSchema, GitLabUserSchema, GitLabUsersResponseSchema, GitLabWikiPageSchema, GroupIteration, ListCommitsSchema, ListDraftNotesSchema, ListGroupIterationsSchema, ListGroupProjectsSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListLabelsSchema, ListMergeRequestDiffsSchema, // Added
|
|
32
|
-
ListMergeRequestDiscussionsSchema, ListMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListPipelineTriggerJobsSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListWikiPagesSchema, MarkdownUploadSchema, DownloadAttachmentSchema, MergeMergeRequestSchema, MyIssuesSchema, PaginatedDiscussionsResponseSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, RetryPipelineSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateLabelSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateWikiPageSchema, VerifyNamespaceSchema } from "./schemas.js";
|
|
32
|
+
ListMergeRequestDiscussionsSchema, ListMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListPipelineTriggerJobsSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListWikiPagesSchema, MarkdownUploadSchema, DownloadAttachmentSchema, MergeMergeRequestSchema, MyIssuesSchema, PaginatedDiscussionsResponseSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PlayPipelineJobSchema, PushFilesSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateLabelSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateWikiPageSchema, VerifyNamespaceSchema, GitLabEventSchema, ListEventsSchema, GetProjectEventsSchema } from "./schemas.js";
|
|
33
33
|
import { randomUUID } from "crypto";
|
|
34
34
|
import { pino } from "pino";
|
|
35
35
|
const logger = pino({
|
|
@@ -545,6 +545,21 @@ const allTools = [
|
|
|
545
545
|
description: "Cancel a running pipeline",
|
|
546
546
|
inputSchema: zodToJsonSchema(CancelPipelineSchema),
|
|
547
547
|
},
|
|
548
|
+
{
|
|
549
|
+
name: "play_pipeline_job",
|
|
550
|
+
description: "Run a manual pipeline job",
|
|
551
|
+
inputSchema: zodToJsonSchema(PlayPipelineJobSchema),
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: "retry_pipeline_job",
|
|
555
|
+
description: "Retry a failed or canceled pipeline job",
|
|
556
|
+
inputSchema: zodToJsonSchema(RetryPipelineJobSchema),
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: "cancel_pipeline_job",
|
|
560
|
+
description: "Cancel a running pipeline job",
|
|
561
|
+
inputSchema: zodToJsonSchema(CancelPipelineJobSchema),
|
|
562
|
+
},
|
|
548
563
|
{
|
|
549
564
|
name: "list_merge_requests",
|
|
550
565
|
description: "List merge requests in a GitLab project with filtering options",
|
|
@@ -630,6 +645,16 @@ const allTools = [
|
|
|
630
645
|
description: "Download an uploaded file from a GitLab project by secret and filename",
|
|
631
646
|
inputSchema: zodToJsonSchema(DownloadAttachmentSchema),
|
|
632
647
|
},
|
|
648
|
+
{
|
|
649
|
+
name: "list_events",
|
|
650
|
+
description: "List all events for the currently authenticated user. Note: before/after parameters accept date format YYYY-MM-DD only",
|
|
651
|
+
inputSchema: zodToJsonSchema(ListEventsSchema),
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
name: "get_project_events",
|
|
655
|
+
description: "List all visible events for a specified project. Note: before/after parameters accept date format YYYY-MM-DD only",
|
|
656
|
+
inputSchema: zodToJsonSchema(GetProjectEventsSchema),
|
|
657
|
+
},
|
|
633
658
|
];
|
|
634
659
|
// Define which tools are read-only
|
|
635
660
|
const readOnlyTools = [
|
|
@@ -676,6 +701,8 @@ const readOnlyTools = [
|
|
|
676
701
|
"list_group_iterations",
|
|
677
702
|
"get_group_iteration",
|
|
678
703
|
"download_attachment",
|
|
704
|
+
"list_events",
|
|
705
|
+
"get_project_events",
|
|
679
706
|
];
|
|
680
707
|
// Define which tools are related to wiki and can be toggled by USE_GITLAB_WIKI
|
|
681
708
|
const wikiToolNames = [
|
|
@@ -709,6 +736,9 @@ const pipelineToolNames = [
|
|
|
709
736
|
"create_pipeline",
|
|
710
737
|
"retry_pipeline",
|
|
711
738
|
"cancel_pipeline",
|
|
739
|
+
"play_pipeline_job",
|
|
740
|
+
"retry_pipeline_job",
|
|
741
|
+
"cancel_pipeline_job",
|
|
712
742
|
];
|
|
713
743
|
/**
|
|
714
744
|
* Smart URL handling for GitLab API
|
|
@@ -2592,6 +2622,70 @@ async function cancelPipeline(projectId, pipelineId) {
|
|
|
2592
2622
|
const data = await response.json();
|
|
2593
2623
|
return GitLabPipelineSchema.parse(data);
|
|
2594
2624
|
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Run a manual job
|
|
2627
|
+
*
|
|
2628
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
2629
|
+
* @param {number} jobId - The ID of the job to run
|
|
2630
|
+
* @param {Object} variables - Optional job variables
|
|
2631
|
+
* @returns {Promise<GitLabPipelineJob>} The run job
|
|
2632
|
+
*/
|
|
2633
|
+
async function playPipelineJob(projectId, jobId, variables) {
|
|
2634
|
+
projectId = decodeURIComponent(projectId);
|
|
2635
|
+
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/jobs/${jobId}/play`);
|
|
2636
|
+
const body = {};
|
|
2637
|
+
if (variables && variables.length > 0) {
|
|
2638
|
+
body.job_variables_attributes = variables;
|
|
2639
|
+
}
|
|
2640
|
+
const response = await fetch(url.toString(), {
|
|
2641
|
+
...DEFAULT_FETCH_CONFIG,
|
|
2642
|
+
method: "POST",
|
|
2643
|
+
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined,
|
|
2644
|
+
});
|
|
2645
|
+
await handleGitLabError(response);
|
|
2646
|
+
const data = await response.json();
|
|
2647
|
+
return GitLabPipelineJobSchema.parse(data);
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Retry a job
|
|
2651
|
+
*
|
|
2652
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
2653
|
+
* @param {number} jobId - The ID of the job to retry
|
|
2654
|
+
* @returns {Promise<GitLabPipelineJob>} The retried job
|
|
2655
|
+
*/
|
|
2656
|
+
async function retryPipelineJob(projectId, jobId) {
|
|
2657
|
+
projectId = decodeURIComponent(projectId);
|
|
2658
|
+
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/jobs/${jobId}/retry`);
|
|
2659
|
+
const response = await fetch(url.toString(), {
|
|
2660
|
+
...DEFAULT_FETCH_CONFIG,
|
|
2661
|
+
method: "POST",
|
|
2662
|
+
});
|
|
2663
|
+
await handleGitLabError(response);
|
|
2664
|
+
const data = await response.json();
|
|
2665
|
+
return GitLabPipelineJobSchema.parse(data);
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Cancel a job
|
|
2669
|
+
*
|
|
2670
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
2671
|
+
* @param {number} jobId - The ID of the job to cancel
|
|
2672
|
+
* @param {boolean} force - Force cancellation of the job
|
|
2673
|
+
* @returns {Promise<GitLabPipelineJob>} The canceled job
|
|
2674
|
+
*/
|
|
2675
|
+
async function cancelPipelineJob(projectId, jobId, force) {
|
|
2676
|
+
projectId = decodeURIComponent(projectId);
|
|
2677
|
+
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/jobs/${jobId}/cancel`);
|
|
2678
|
+
if (force !== undefined) {
|
|
2679
|
+
url.searchParams.append('force', force.toString());
|
|
2680
|
+
}
|
|
2681
|
+
const response = await fetch(url.toString(), {
|
|
2682
|
+
...DEFAULT_FETCH_CONFIG,
|
|
2683
|
+
method: "POST",
|
|
2684
|
+
});
|
|
2685
|
+
await handleGitLabError(response);
|
|
2686
|
+
const data = await response.json();
|
|
2687
|
+
return GitLabPipelineJobSchema.parse(data);
|
|
2688
|
+
}
|
|
2595
2689
|
/**
|
|
2596
2690
|
* Get the repository tree for a project
|
|
2597
2691
|
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
@@ -3099,6 +3193,54 @@ async function downloadAttachment(projectId, secret, filename, localPath) {
|
|
|
3099
3193
|
fs.writeFileSync(savePath, Buffer.from(buffer));
|
|
3100
3194
|
return savePath;
|
|
3101
3195
|
}
|
|
3196
|
+
/**
|
|
3197
|
+
* List all events for the currently authenticated user
|
|
3198
|
+
* @param {Object} options - Options for listing events
|
|
3199
|
+
* @returns {Promise<GitLabEvent[]>} List of events
|
|
3200
|
+
*/
|
|
3201
|
+
async function listEvents(options = {}) {
|
|
3202
|
+
const url = new URL(`${GITLAB_API_URL}/events`);
|
|
3203
|
+
// Add all query parameters
|
|
3204
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
3205
|
+
if (value !== undefined) {
|
|
3206
|
+
url.searchParams.append(key, value.toString());
|
|
3207
|
+
}
|
|
3208
|
+
});
|
|
3209
|
+
const response = await fetch(url.toString(), {
|
|
3210
|
+
method: "GET",
|
|
3211
|
+
headers: DEFAULT_HEADERS,
|
|
3212
|
+
});
|
|
3213
|
+
if (!response.ok) {
|
|
3214
|
+
await handleGitLabError(response);
|
|
3215
|
+
}
|
|
3216
|
+
const data = await response.json();
|
|
3217
|
+
return GitLabEventSchema.array().parse(data);
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* List all visible events for a specified project
|
|
3221
|
+
* @param {string} projectId - Project ID or URL-encoded path
|
|
3222
|
+
* @param {Object} options - Options for getting project events
|
|
3223
|
+
* @returns {Promise<GitLabEvent[]>} List of project events
|
|
3224
|
+
*/
|
|
3225
|
+
async function getProjectEvents(projectId, options = {}) {
|
|
3226
|
+
const effectiveProjectId = getEffectiveProjectId(projectId);
|
|
3227
|
+
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(effectiveProjectId)}/events`);
|
|
3228
|
+
// Add all query parameters
|
|
3229
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
3230
|
+
if (value !== undefined) {
|
|
3231
|
+
url.searchParams.append(key, value.toString());
|
|
3232
|
+
}
|
|
3233
|
+
});
|
|
3234
|
+
const response = await fetch(url.toString(), {
|
|
3235
|
+
method: "GET",
|
|
3236
|
+
headers: DEFAULT_HEADERS,
|
|
3237
|
+
});
|
|
3238
|
+
if (!response.ok) {
|
|
3239
|
+
await handleGitLabError(response);
|
|
3240
|
+
}
|
|
3241
|
+
const data = await response.json();
|
|
3242
|
+
return GitLabEventSchema.array().parse(data);
|
|
3243
|
+
}
|
|
3102
3244
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
3103
3245
|
// Apply read-only filter first
|
|
3104
3246
|
const tools0 = GITLAB_READ_ONLY_MODE
|
|
@@ -3784,6 +3926,42 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3784
3926
|
],
|
|
3785
3927
|
};
|
|
3786
3928
|
}
|
|
3929
|
+
case "play_pipeline_job": {
|
|
3930
|
+
const { project_id, job_id, job_variables_attributes } = PlayPipelineJobSchema.parse(request.params.arguments);
|
|
3931
|
+
const job = await playPipelineJob(project_id, job_id, job_variables_attributes);
|
|
3932
|
+
return {
|
|
3933
|
+
content: [
|
|
3934
|
+
{
|
|
3935
|
+
type: "text",
|
|
3936
|
+
text: `Ran job #${job.id} (${job.name}). Status: ${job.status}\nWeb URL: ${job.web_url}`,
|
|
3937
|
+
},
|
|
3938
|
+
],
|
|
3939
|
+
};
|
|
3940
|
+
}
|
|
3941
|
+
case "retry_pipeline_job": {
|
|
3942
|
+
const { project_id, job_id } = RetryPipelineJobSchema.parse(request.params.arguments);
|
|
3943
|
+
const job = await retryPipelineJob(project_id, job_id);
|
|
3944
|
+
return {
|
|
3945
|
+
content: [
|
|
3946
|
+
{
|
|
3947
|
+
type: "text",
|
|
3948
|
+
text: `Retried job #${job.id} (${job.name}). Status: ${job.status}\nWeb URL: ${job.web_url}`,
|
|
3949
|
+
},
|
|
3950
|
+
],
|
|
3951
|
+
};
|
|
3952
|
+
}
|
|
3953
|
+
case "cancel_pipeline_job": {
|
|
3954
|
+
const { project_id, job_id, force } = CancelPipelineJobSchema.parse(request.params.arguments);
|
|
3955
|
+
const job = await cancelPipelineJob(project_id, job_id, force);
|
|
3956
|
+
return {
|
|
3957
|
+
content: [
|
|
3958
|
+
{
|
|
3959
|
+
type: "text",
|
|
3960
|
+
text: `Canceled job #${job.id} (${job.name}). Status: ${job.status}\nWeb URL: ${job.web_url}`,
|
|
3961
|
+
},
|
|
3962
|
+
],
|
|
3963
|
+
};
|
|
3964
|
+
}
|
|
3787
3965
|
case "list_merge_requests": {
|
|
3788
3966
|
const args = ListMergeRequestsSchema.parse(request.params.arguments);
|
|
3789
3967
|
const mergeRequests = await listMergeRequests(args.project_id, args);
|
|
@@ -3944,6 +4122,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3944
4122
|
content: [{ type: "text", text: JSON.stringify({ success: true, file_path: filePath }, null, 2) }],
|
|
3945
4123
|
};
|
|
3946
4124
|
}
|
|
4125
|
+
case "list_events": {
|
|
4126
|
+
const args = ListEventsSchema.parse(request.params.arguments);
|
|
4127
|
+
const events = await listEvents(args);
|
|
4128
|
+
return {
|
|
4129
|
+
content: [{ type: "text", text: JSON.stringify(events, null, 2) }],
|
|
4130
|
+
};
|
|
4131
|
+
}
|
|
4132
|
+
case "get_project_events": {
|
|
4133
|
+
const args = GetProjectEventsSchema.parse(request.params.arguments);
|
|
4134
|
+
const { project_id, ...options } = args;
|
|
4135
|
+
const events = await getProjectEvents(project_id, options);
|
|
4136
|
+
return {
|
|
4137
|
+
content: [{ type: "text", text: JSON.stringify(events, null, 2) }],
|
|
4138
|
+
};
|
|
4139
|
+
}
|
|
3947
4140
|
default:
|
|
3948
4141
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
3949
4142
|
}
|
package/build/schemas.js
CHANGED
|
@@ -282,6 +282,31 @@ export const GetPipelineJobOutputSchema = z.object({
|
|
|
282
282
|
.optional()
|
|
283
283
|
.describe("Number of lines to skip from the end of the log (default: 0)"),
|
|
284
284
|
});
|
|
285
|
+
// Schema for pipeline job control operations
|
|
286
|
+
export const PipelineJobControlSchema = z.object({
|
|
287
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
288
|
+
job_id: z.coerce.string().describe("The ID of the job"),
|
|
289
|
+
});
|
|
290
|
+
// Schema for running a manual job
|
|
291
|
+
export const PlayPipelineJobSchema = z.object({
|
|
292
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
293
|
+
job_id: z.coerce.string().describe("The ID of the job"),
|
|
294
|
+
job_variables_attributes: z
|
|
295
|
+
.array(z.object({
|
|
296
|
+
key: z.string().describe("Variable key"),
|
|
297
|
+
value: z.string().describe("Variable value"),
|
|
298
|
+
}))
|
|
299
|
+
.optional()
|
|
300
|
+
.describe("Custom job variables to use when running the job"),
|
|
301
|
+
});
|
|
302
|
+
// Schema for retrying a job
|
|
303
|
+
export const RetryPipelineJobSchema = PipelineJobControlSchema;
|
|
304
|
+
// Schema for canceling a job
|
|
305
|
+
export const CancelPipelineJobSchema = z.object({
|
|
306
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
307
|
+
job_id: z.coerce.string().describe("The ID of the job"),
|
|
308
|
+
force: z.boolean().optional().describe("Force cancellation of the job"),
|
|
309
|
+
});
|
|
285
310
|
// User schemas
|
|
286
311
|
export const GitLabUserSchema = z.object({
|
|
287
312
|
username: z.string().optional(), // Changed from login to match GitLab API
|
|
@@ -1681,3 +1706,49 @@ export const ListGroupIterationsSchema = z
|
|
|
1681
1706
|
.describe("Return only iterations updated after the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z)."),
|
|
1682
1707
|
})
|
|
1683
1708
|
.merge(PaginationOptionsSchema);
|
|
1709
|
+
// Events API schemas
|
|
1710
|
+
export const GitLabEventAuthorSchema = z.object({
|
|
1711
|
+
id: z.coerce.string(),
|
|
1712
|
+
name: z.string(),
|
|
1713
|
+
username: z.string(),
|
|
1714
|
+
state: z.string(),
|
|
1715
|
+
avatar_url: z.string().nullable(),
|
|
1716
|
+
web_url: z.string(),
|
|
1717
|
+
});
|
|
1718
|
+
export const GitLabEventSchema = z.object({
|
|
1719
|
+
id: z.coerce.string(),
|
|
1720
|
+
project_id: z.coerce.string(),
|
|
1721
|
+
action_name: z.string(),
|
|
1722
|
+
target_id: z.coerce.string().nullable(),
|
|
1723
|
+
target_iid: z.coerce.string().nullable(),
|
|
1724
|
+
target_type: z.string().nullable(),
|
|
1725
|
+
author_id: z.coerce.string(),
|
|
1726
|
+
target_title: z.string().nullable(),
|
|
1727
|
+
created_at: z.string(),
|
|
1728
|
+
author: GitLabEventAuthorSchema,
|
|
1729
|
+
author_username: z.string(),
|
|
1730
|
+
imported: flexibleBoolean,
|
|
1731
|
+
imported_from: z.string(),
|
|
1732
|
+
}).passthrough(); // Allow additional fields
|
|
1733
|
+
// List events schema
|
|
1734
|
+
export const ListEventsSchema = z.object({
|
|
1735
|
+
action: z.string().optional().describe("If defined, returns events with the specified action type"),
|
|
1736
|
+
target_type: z.enum(["epic", "issue", "merge_request", "milestone", "note", "project", "snippet", "user"]).optional().describe("If defined, returns events with the specified target type"),
|
|
1737
|
+
before: z.string().optional().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"),
|
|
1738
|
+
after: z.string().optional().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"),
|
|
1739
|
+
scope: z.string().optional().describe("Include all events across a user's projects"),
|
|
1740
|
+
sort: z.enum(["asc", "desc"]).optional().describe("Direction to sort the results by creation date. Default: desc"),
|
|
1741
|
+
page: z.number().optional().describe("Returns the specified results page. Default: 1"),
|
|
1742
|
+
per_page: z.number().optional().describe("Number of results per page. Default: 20"),
|
|
1743
|
+
});
|
|
1744
|
+
// Get project events schema
|
|
1745
|
+
export const GetProjectEventsSchema = z.object({
|
|
1746
|
+
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
|
|
1747
|
+
action: z.string().optional().describe("If defined, returns events with the specified action type"),
|
|
1748
|
+
target_type: z.enum(["epic", "issue", "merge_request", "milestone", "note", "project", "snippet", "user"]).optional().describe("If defined, returns events with the specified target type"),
|
|
1749
|
+
before: z.string().optional().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"),
|
|
1750
|
+
after: z.string().optional().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"),
|
|
1751
|
+
sort: z.enum(["asc", "desc"]).optional().describe("Direction to sort the results by creation date. Default: desc"),
|
|
1752
|
+
page: z.number().optional().describe("Returns the specified results page. Default: 1"),
|
|
1753
|
+
per_page: z.number().optional().describe("Number of results per page. Default: 20"),
|
|
1754
|
+
});
|