[main] feat: update milestone management tools and improve code formatting ✨
🚀 Breaking Changes: - Updated version from 1.0.48 to 1.0.50 - Refactored code for better readability and consistency 📝 Details: - Improved descriptions and formatting in index.ts - Ensured consistent use of URL encoding in API calls
This commit is contained in:
92
index.ts
92
index.ts
@ -489,7 +489,8 @@ const allTools = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "list_merge_requests",
|
name: "list_merge_requests",
|
||||||
description: "List merge requests in a GitLab project with filtering options",
|
description:
|
||||||
|
"List merge requests in a GitLab project with filtering options",
|
||||||
inputSchema: zodToJsonSchema(ListMergeRequestsSchema),
|
inputSchema: zodToJsonSchema(ListMergeRequestsSchema),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -570,7 +571,7 @@ const readOnlyTools = [
|
|||||||
"get_milestone",
|
"get_milestone",
|
||||||
"get_milestone_issue",
|
"get_milestone_issue",
|
||||||
"get_milestone_merge_requests",
|
"get_milestone_merge_requests",
|
||||||
"get_milestone_burndown_events"
|
"get_milestone_burndown_events",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Define which tools are related to wiki and can be toggled by USE_GITLAB_WIKI
|
// Define which tools are related to wiki and can be toggled by USE_GITLAB_WIKI
|
||||||
@ -2500,7 +2501,9 @@ async function getPipeline(
|
|||||||
): Promise<GitLabPipeline> {
|
): Promise<GitLabPipeline> {
|
||||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
projectId = decodeURIComponent(projectId); // Decode project ID
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/pipelines/${pipelineId}`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/pipelines/${pipelineId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2531,7 +2534,9 @@ async function listPipelineJobs(
|
|||||||
): Promise<GitLabPipelineJob[]> {
|
): Promise<GitLabPipelineJob[]> {
|
||||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
projectId = decodeURIComponent(projectId); // Decode project ID
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/pipelines/${pipelineId}/jobs`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/pipelines/${pipelineId}/jobs`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add all query parameters
|
// Add all query parameters
|
||||||
@ -2563,9 +2568,7 @@ async function getPipelineJob(
|
|||||||
): Promise<GitLabPipelineJob> {
|
): Promise<GitLabPipelineJob> {
|
||||||
projectId = decodeURIComponent(projectId); // Decode project ID
|
projectId = decodeURIComponent(projectId); // Decode project ID
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/jobs/${jobId}`
|
||||||
projectId
|
|
||||||
)}/jobs/${jobId}`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2705,7 +2708,9 @@ async function getProjectMilestone(
|
|||||||
): Promise<GitLabMilestones> {
|
): Promise<GitLabMilestones> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2751,11 +2756,16 @@ async function createProjectMilestone(
|
|||||||
async function editProjectMilestone(
|
async function editProjectMilestone(
|
||||||
projectId: string,
|
projectId: string,
|
||||||
milestoneId: number,
|
milestoneId: number,
|
||||||
options: Omit<z.infer<typeof EditProjectMilestoneSchema>, "project_id" | "milestone_id">
|
options: Omit<
|
||||||
|
z.infer<typeof EditProjectMilestoneSchema>,
|
||||||
|
"project_id" | "milestone_id"
|
||||||
|
>
|
||||||
): Promise<GitLabMilestones> {
|
): Promise<GitLabMilestones> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2780,7 +2790,9 @@ async function deleteProjectMilestone(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2802,7 +2814,9 @@ async function getMilestoneIssues(
|
|||||||
): Promise<GitLabIssue[]> {
|
): Promise<GitLabIssue[]> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}/issues`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}/issues`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2825,7 +2839,9 @@ async function getMilestoneMergeRequests(
|
|||||||
): Promise<GitLabMergeRequest[]> {
|
): Promise<GitLabMergeRequest[]> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}/merge_requests`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}/merge_requests`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2848,7 +2864,9 @@ async function promoteProjectMilestone(
|
|||||||
): Promise<GitLabMilestones> {
|
): Promise<GitLabMilestones> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}/promote`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}/promote`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -2872,7 +2890,9 @@ async function getMilestoneBurndownEvents(
|
|||||||
): Promise<any[]> {
|
): Promise<any[]> {
|
||||||
projectId = decodeURIComponent(projectId);
|
projectId = decodeURIComponent(projectId);
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/milestones/${milestoneId}/burndown_events`
|
`${GITLAB_API_URL}/projects/${encodeURIComponent(
|
||||||
|
projectId
|
||||||
|
)}/milestones/${milestoneId}/burndown_events`
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
const response = await fetch(url.toString(), {
|
||||||
@ -3595,9 +3615,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "list_pipeline_jobs": {
|
case "list_pipeline_jobs": {
|
||||||
const { project_id, pipeline_id, ...options } = ListPipelineJobsSchema.parse(
|
const { project_id, pipeline_id, ...options } =
|
||||||
request.params.arguments
|
ListPipelineJobsSchema.parse(request.params.arguments);
|
||||||
);
|
|
||||||
const jobs = await listPipelineJobs(project_id, pipeline_id, options);
|
const jobs = await listPipelineJobs(project_id, pipeline_id, options);
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
@ -3643,7 +3662,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
const args = ListMergeRequestsSchema.parse(request.params.arguments);
|
const args = ListMergeRequestsSchema.parse(request.params.arguments);
|
||||||
const mergeRequests = await listMergeRequests(args.project_id, args);
|
const mergeRequests = await listMergeRequests(args.project_id, args);
|
||||||
return {
|
return {
|
||||||
content: [{ type: "text", text: JSON.stringify(mergeRequests, null, 2) }],
|
content: [
|
||||||
|
{ type: "text", text: JSON.stringify(mergeRequests, null, 2) },
|
||||||
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3693,10 +3714,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "edit_milestone": {
|
case "edit_milestone": {
|
||||||
const { project_id, milestone_id, ...options } = EditProjectMilestoneSchema.parse(
|
const { project_id, milestone_id, ...options } =
|
||||||
request.params.arguments
|
EditProjectMilestoneSchema.parse(request.params.arguments);
|
||||||
|
const milestone = await editProjectMilestone(
|
||||||
|
project_id,
|
||||||
|
milestone_id,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
const milestone = await editProjectMilestone(project_id, milestone_id, options);
|
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@ -3745,10 +3769,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "get_milestone_merge_requests": {
|
case "get_milestone_merge_requests": {
|
||||||
const { project_id, milestone_id } = GetMilestoneMergeRequestsSchema.parse(
|
const { project_id, milestone_id } =
|
||||||
request.params.arguments
|
GetMilestoneMergeRequestsSchema.parse(request.params.arguments);
|
||||||
|
const mergeRequests = await getMilestoneMergeRequests(
|
||||||
|
project_id,
|
||||||
|
milestone_id
|
||||||
);
|
);
|
||||||
const mergeRequests = await getMilestoneMergeRequests(project_id, milestone_id);
|
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@ -3760,10 +3786,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "promote_milestone": {
|
case "promote_milestone": {
|
||||||
const { project_id, milestone_id } = PromoteProjectMilestoneSchema.parse(
|
const { project_id, milestone_id } =
|
||||||
request.params.arguments
|
PromoteProjectMilestoneSchema.parse(request.params.arguments);
|
||||||
|
const milestone = await promoteProjectMilestone(
|
||||||
|
project_id,
|
||||||
|
milestone_id
|
||||||
);
|
);
|
||||||
const milestone = await promoteProjectMilestone(project_id, milestone_id);
|
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@ -3775,10 +3803,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "get_milestone_burndown_events": {
|
case "get_milestone_burndown_events": {
|
||||||
const { project_id, milestone_id } = GetMilestoneBurndownEventsSchema.parse(
|
const { project_id, milestone_id } =
|
||||||
request.params.arguments
|
GetMilestoneBurndownEventsSchema.parse(request.params.arguments);
|
||||||
|
const events = await getMilestoneBurndownEvents(
|
||||||
|
project_id,
|
||||||
|
milestone_id
|
||||||
);
|
);
|
||||||
const events = await getMilestoneBurndownEvents(project_id, milestone_id);
|
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@zereight/mcp-gitlab",
|
"name": "@zereight/mcp-gitlab",
|
||||||
"version": "1.0.48",
|
"version": "1.0.50",
|
||||||
"description": "MCP server for using the GitLab API",
|
"description": "MCP server for using the GitLab API",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "zereight",
|
"author": "zereight",
|
||||||
|
Reference in New Issue
Block a user