Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYes
stateNo
pageNo
per_pageNo

Implementation Reference

  • 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);
    }
  • 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)
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheRealChrisThomas/gitlab-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server