Skip to main content
Glama

list_milestones

Retrieve GitHub project milestones to track progress and manage deadlines. Filter by status and customize sorting for project oversight.

Instructions

List milestones

Input Schema

NameRequiredDescriptionDefault
statusYes
sortNo
directionNo

Input Schema (JSON Schema)

{ "properties": { "direction": { "type": "string" }, "sort": { "type": "string" }, "status": { "type": "string" } }, "required": [ "status" ], "type": "object" }

Implementation Reference

  • Main handler function that executes the list_milestones tool: fetches milestones from repository, applies status filter, sorts by specified criteria (due_date, title, created_at), and returns the list.
    async listMilestones( status: string = 'open', sort: string = 'created_at', direction: string = 'asc' ): Promise<Milestone[]> { try { // Get all milestones const milestones = await this.milestoneRepo.findAll(); // Filter by status if needed let filteredMilestones = milestones; if (status !== 'all') { const resourceStatus = status === 'open' ? ResourceStatus.ACTIVE : ResourceStatus.CLOSED; filteredMilestones = milestones.filter(milestone => milestone.status === resourceStatus); } // Sort the milestones filteredMilestones.sort((a, b) => { let valueA, valueB; switch(sort) { case 'due_date': valueA = a.dueDate || ''; valueB = b.dueDate || ''; break; case 'title': valueA = a.title; valueB = b.title; break; case 'created_at': default: valueA = a.createdAt; valueB = b.createdAt; } const comparison = valueA.localeCompare(valueB); return direction === 'asc' ? comparison : -comparison; }); return filteredMilestones; } catch (error) { throw this.mapErrorToMCPError(error); } }
  • Zod schema defining the input arguments for the list_milestones tool: status (open/closed/all), sort (due_date/title/created_at), direction (asc/desc).
    // Schema for list_milestones tool export const listMilestonesSchema = z.object({ status: z.enum(["open", "closed", "all"]).default("open"), sort: z.enum(["due_date", "title", "created_at"]).default("created_at").optional(), direction: z.enum(["asc", "desc"]).default("asc").optional(), }); export type ListMilestonesArgs = z.infer<typeof listMilestonesSchema>;
  • Registers the listMilestonesTool as part of the milestone tools in the central ToolRegistry singleton.
    // Register milestone tools this.registerTool(createMilestoneTool); this.registerTool(listMilestonesTool); this.registerTool(updateMilestoneTool); this.registerTool(deleteMilestoneTool);
  • Repository method that executes GraphQL query to fetch all milestones from GitHub and maps them to domain Milestone objects.
    async findAll(): Promise<Milestone[]> { const query = ` query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { milestones(first: 100) { nodes { id number title description dueOn state createdAt updatedAt } } } } `; const response = await this.graphql<ListMilestonesResponse>(query, { owner: this.owner, repo: this.repo, }); return response.repository.milestones.nodes.map(milestone => this.mapGitHubMilestoneToMilestone(milestone) ); }
  • MCP tool dispatch handler that routes list_milestones calls to the ProjectManagementService.
    case "list_milestones": return await this.service.listMilestones(args.status, args.sort, args.direction);

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/HarshKumarSharma/MCP'

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