add_issues_to_sprint
Assign multiple GitHub issues to a specific sprint in a project using the sprint ID and issue IDs, streamlining sprint planning and task organization.
Instructions
Add issues to an existing sprint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueIds | Yes | ||
| sprintId | Yes |
Implementation Reference
- Main handler method that loops over issue IDs and calls the repository to add each issue to the sprint, returns success count and message.async addIssuesToSprint(data: { sprintId: string; issueIds: string[]; }): Promise<{ success: boolean; addedIssues: number; message: string }> { try { let addedCount = 0; const issues = []; // Add each issue to the sprint for (const issueId of data.issueIds) { try { await this.sprintRepo.addIssue(data.sprintId, issueId); addedCount++; issues.push(issueId); } catch (error) { process.stderr.write(`Failed to add issue ${issueId} to sprint: ${error}`); } } return { success: addedCount > 0, addedIssues: addedCount, message: `Added ${addedCount} issue(s) to sprint ${data.sprintId}` }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- src/infrastructure/tools/ToolRegistry.ts:238-238 (registration)Registers the addIssuesToSprintTool in the central tool registry during initialization.this.registerTool(addIssuesToSprintTool);
- Defines the tool schema, description, and examples for add_issues_to_sprint using Zod validation.export const addIssuesToSprintTool: ToolDefinition<AddIssuesToSprintArgs> = { name: "add_issues_to_sprint", description: "Add issues to an existing sprint", schema: addIssuesToSprintSchema as unknown as ToolSchema<AddIssuesToSprintArgs>, examples: [ { name: "Add issues to sprint", description: "Add multiple issues to an existing sprint", args: { sprintId: "sprint_1", issueIds: ["123", "124", "125"] } } ] };
- src/index.ts:377-378 (handler)MCP server tool dispatch handler that routes the tool call to the ProjectManagementService.case "add_issues_to_sprint": return await this.service.addIssuesToSprint(args);
- Low-level repository method that uses GraphQL mutation to assign issues to sprint iteration field in GitHub Projects V2.private async addIssuesToSprint(sprintId: string, issueIds: IssueId[]): Promise<void> { const addItemQuery = ` mutation($input: UpdateProjectV2ItemFieldValueInput!) { updateProjectV2ItemFieldValue(input: $input) { projectV2Item { id } } } `; for (const issueId of issueIds) { await this.graphql(addItemQuery, { input: { projectId: this.config.projectId, itemId: `Issue_${issueId}`, fieldId: sprintId, value: "ITERATION", }, }); } }