Skip to main content
Glama

update_milestone

Modify GitHub milestone details including title, description, due date, and status to track project progress and deadlines.

Instructions

Update a GitHub milestone

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
milestoneIdYes
titleNo
descriptionNo
dueDateYes
stateNo

Implementation Reference

  • Primary handler for update_milestone tool: validates input, maps to domain model, calls repository to update GitHub milestone
    async updateMilestone(data: {
      milestoneId: string;
      title?: string;
      description?: string;
      dueDate?: string | null;
      state?: 'open' | 'closed';
    }): Promise<Milestone> {
      try {
        // Convert state to ResourceStatus if provided
        let status: ResourceStatus | undefined;
        if (data.state) {
          status = data.state === 'open' ? ResourceStatus.ACTIVE : ResourceStatus.CLOSED;
        }
    
        // Map input data to domain model
        const milestoneData: Partial<Milestone> = {
          title: data.title,
          description: data.description,
          dueDate: data.dueDate === null ? undefined : data.dueDate,
          status
        };
    
        // Clean up undefined values
        Object.keys(milestoneData).forEach(key => {
          if (milestoneData[key as keyof Partial<Milestone>] === undefined) {
            delete milestoneData[key as keyof Partial<Milestone>];
          }
        });
    
        return await this.milestoneRepo.update(data.milestoneId, milestoneData);
      } catch (error) {
        throw this.mapErrorToMCPError(error);
      }
    }
  • Core implementation: calls GitHub REST API octokit.rest.issues.updateMilestone to perform the actual update
    async update(id: MilestoneId, data: Partial<Milestone>): Promise<Milestone> {
      // Use REST API for milestone updates since GraphQL doesn't support it
      const response = await this.rest(
        (params) => this.octokit.rest.issues.updateMilestone(params),
        {
          milestone_number: parseInt(id),
          title: data.title,
          description: data.description,
          due_on: data.dueDate,
          state: data.status === ResourceStatus.CLOSED ? "closed" : "open",
        }
      );
    
      return this.mapRestMilestoneToMilestone(response);
    }
  • Zod input schema validation for update_milestone tool
    // Schema for update_milestone tool
    export const updateMilestoneSchema = z.object({
      milestoneId: z.string().min(1, "Milestone ID is required"),
      title: z.string().optional(),
      description: z.string().optional(),
      dueDate: z.string().datetime().optional().nullable(),
      state: z.enum(["open", "closed"]).optional(),
    });
    
    export type UpdateMilestoneArgs = z.infer<typeof updateMilestoneSchema>;
  • Registers the update_milestone tool in the central ToolRegistry during initialization
    this.registerTool(updateMilestoneTool);
  • MCP tool dispatch handler: routes call_tool requests for 'update_milestone' to ProjectManagementService
    case "update_milestone":
      return await this.service.updateMilestone(args);

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