list_milestones
Retrieve milestones from a GitLab project to track progress and manage project timelines effectively.
Instructions
List all milestones in a GitLab project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| state | No | ||
| page | No | ||
| per_page | No |
Implementation Reference
- src/api/milestones.ts:6-31 (handler)The handler function `listMilestones` that performs the API call to list milestones for a project.
export async function listMilestones( projectId: string, state?: "active" | "closed", page: number = 1, perPage: number = 20 ): Promise<GitLabMilestoneResponse[]> { if (!projectId?.trim()) { throw new Error("Project ID is required"); } if (page < 1) { throw new Error("Page number must be 1 or greater"); } if (perPage < 1 || perPage > 100) { throw new Error("Per page must be between 1 and 100"); } const endpoint = `/projects/${encodeProjectId(projectId)}/milestones`; const params = buildSearchParams({ ...(state && { state }), page: page.toString(), per_page: perPage.toString() }); const milestones = await gitlabGet<GitLabMilestoneResponse[]>(endpoint, params); return z.array(GitLabMilestoneSchema).parse(milestones); } - src/schemas.ts:342-347 (schema)Zod schema `ListMilestonesSchema` defining the input validation for the tool.
export const ListMilestonesSchema = z.object({ project_id: z.string(), state: z.enum(["active", "closed"]).optional(), page: z.number().optional(), per_page: z.number().optional() }); - src/server.ts:129-133 (registration)Registration of the `list_milestones` tool in `server.ts`.
{ name: "list_milestones", description: "List all milestones in a GitLab project", inputSchema: zodToJsonSchema(ListMilestonesSchema) },