get_sprint_metrics
Extract progress metrics for a specific sprint, including task details, to analyze and optimize GitHub project workflows. Integrates with GitHub Projects V2 for efficient sprint management.
Instructions
Get progress metrics for a specific sprint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeIssues | Yes | ||
| sprintId | Yes |
Implementation Reference
- Core handler function that fetches sprint data, retrieves associated issues, calculates completion metrics (total/completed/remaining issues, percentage), determines days remaining and active status, and returns formatted SprintMetrics object.async getSprintMetrics(id: string, includeIssues: boolean = false): Promise<SprintMetrics> { try { const sprint = await this.sprintRepo.findById(id); if (!sprint) { throw new ResourceNotFoundError(ResourceType.SPRINT, id); } const issuePromises = sprint.issues.map((issueId: string) => this.issueRepo.findById(issueId)); const issuesResult = await Promise.all(issuePromises); const issues = issuesResult.filter((issue: Issue | null) => issue !== null) as Issue[]; const totalIssues = issues.length; const completedIssues = issues.filter( issue => issue.status === ResourceStatus.CLOSED || issue.status === ResourceStatus.COMPLETED ).length; const remainingIssues = totalIssues - completedIssues; const completionPercentage = totalIssues > 0 ? Math.round((completedIssues / totalIssues) * 100) : 0; const now = new Date(); const endDate = new Date(sprint.endDate); const daysRemaining = Math.ceil((endDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)); const isActive = now >= new Date(sprint.startDate) && now <= endDate; return { id: sprint.id, title: sprint.title, startDate: sprint.startDate, endDate: sprint.endDate, totalIssues, completedIssues, remainingIssues, completionPercentage, status: sprint.status, issues: includeIssues ? issues : undefined, daysRemaining, isActive }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- ToolDefinition for get_sprint_metrics including name, description, input schema (sprintId: string, includeIssues: boolean), and usage examples.export const getSprintMetricsTool: ToolDefinition<GetSprintMetricsArgs> = { name: "get_sprint_metrics", description: "Get progress metrics for a specific sprint", schema: getSprintMetricsSchema as unknown as ToolSchema<GetSprintMetricsArgs>, examples: [ { name: "Get sprint progress", description: "Get progress metrics for sprint 'sprint_1'", args: { sprintId: "sprint_1", includeIssues: true, }, }, ], };
- src/infrastructure/tools/ToolRegistry.ts:188-188 (registration)Registers the getSprintMetricsTool in the central ToolRegistry during built-in tools initialization.this.registerTool(getSprintMetricsTool);
- src/index.ts:249-250 (handler)MCP server dispatch handler that routes 'get_sprint_metrics' tool calls to ProjectManagementService.getSprintMetrics method.case "get_sprint_metrics": return await this.service.getSprintMetrics(args.sprintId, args.includeIssues);
- src/infrastructure/tools/ToolRegistry.ts:4-117 (registration)Imports getSprintMetricsTool (and other tools) from ToolSchemas for registration (lines 4-117 show the import list).createRoadmapTool, planSprintTool, getMilestoneMetricsTool, getSprintMetricsTool, getOverdueMilestonesTool, getUpcomingMilestonesTool, createProjectTool, listProjectsTool, getProjectTool, createMilestoneTool, listMilestonesTool, createIssueTool, listIssuesTool, getIssueTool, updateIssueTool, // Issue comment tools createIssueCommentTool, updateIssueCommentTool, deleteIssueCommentTool, listIssueCommentsTool, // Draft issue tools createDraftIssueTool, updateDraftIssueTool, deleteDraftIssueTool, // Pull Request tools createPullRequestTool, getPullRequestTool, listPullRequestsTool, updatePullRequestTool, mergePullRequestTool, listPullRequestReviewsTool, createPullRequestReviewTool, createSprintTool, listSprintsTool, getCurrentSprintTool, createProjectFieldTool, createProjectViewTool, // New project tools updateProjectTool, deleteProjectTool, getProjectReadmeTool, updateProjectReadmeTool, listProjectFieldsTool, updateProjectFieldTool, // Project item tools addProjectItemTool, removeProjectItemTool, listProjectItemsTool, archiveProjectItemTool, unarchiveProjectItemTool, // Field values tools setFieldValueTool, getFieldValueTool, clearFieldValueTool, // View tools listProjectViewsTool, updateProjectViewTool, deleteProjectViewTool, // Milestone tools updateMilestoneTool, deleteMilestoneTool, // Sprint tools updateSprintTool, addIssuesToSprintTool, removeIssuesFromSprintTool, // Label tools createLabelTool, listLabelsTool, // AI task management tools addFeatureTool, generatePRDTool, parsePRDTool, getNextTaskTool, analyzeTaskComplexityTool, expandTaskTool, enhancePRDTool, createTraceabilityMatrixTool, // Automation service tools createAutomationRuleTool, updateAutomationRuleTool, deleteAutomationRuleTool, getAutomationRuleTool, listAutomationRulesTool, enableAutomationRuleTool, disableAutomationRuleTool, // Iteration management tools getIterationConfigurationTool, getCurrentIterationTool, getIterationItemsTool, getIterationByDateTool, assignItemsToIterationTool, // AI-powered automation tools generateRoadmapTool, enrichIssueTool, enrichIssuesBulkTool, triageIssueTool, triageAllIssuesTool, scheduleTriagingTool, } from "./ToolSchemas.js";