update_milestone
Modify a GitHub milestone by updating its title, description, due date, or state using specified parameters to manage project timelines effectively.
Instructions
Update a GitHub milestone
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| dueDate | Yes | ||
| milestoneId | Yes | ||
| state | No | ||
| title | No |
Implementation Reference
- Executes the core logic for updating a GitHub milestone by mapping tool arguments to domain model and calling the repository layer.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); } }
- Defines the input schema, description, and examples for the update_milestone tool.export const updateMilestoneTool: ToolDefinition<UpdateMilestoneArgs> = { name: "update_milestone", description: "Update a GitHub milestone", schema: updateMilestoneSchema as unknown as ToolSchema<UpdateMilestoneArgs>, examples: [ { name: "Update milestone due date", description: "Change a milestone's title and due date", args: { milestoneId: "42", title: "Updated Release", dueDate: "2025-08-15T00:00:00Z" } }, { name: "Close milestone", description: "Mark a milestone as closed", args: { milestoneId: "42", state: "closed" } } ] };
- src/infrastructure/tools/ToolRegistry.ts:204-204 (registration)Registers the updateMilestoneTool in the central tool registry during initialization.this.registerTool(updateMilestoneTool);
- src/index.ts:293-294 (handler)Dispatches tool calls to the service handler in the main MCP server switch statement.case "update_milestone": return await this.service.updateMilestone(args);
- Repository layer that performs the actual GitHub API call to update the milestone.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); }