add_issues_to_sprint
Add GitHub issues to an existing sprint for project management and tracking.
Instructions
Add issues to an existing sprint
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sprintId | Yes | ||
| issueIds | Yes |
Input Schema (JSON Schema)
{
"properties": {
"issueIds": {
"items": {
"type": "string"
},
"type": "array"
},
"sprintId": {
"type": "string"
}
},
"required": [
"sprintId",
"issueIds"
],
"type": "object"
}
Implementation Reference
- Main handler function for the 'add_issues_to_sprint' tool. Loops through issueIds and calls sprintRepo.addIssue to add each issue to the sprint, returns success status and count.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); } }
- Zod input schema and TypeScript type definition for the add_issues_to_sprint tool arguments.// Schema for add_issues_to_sprint tool export const addIssuesToSprintSchema = z.object({ sprintId: z.string().min(1, "Sprint ID is required"), issueIds: z.array(z.string()).min(1, "At least one issue ID is required"), }); export type AddIssuesToSprintArgs = z.infer<typeof addIssuesToSprintSchema>;
- src/infrastructure/tools/ToolRegistry.ts:164-166 (registration)Registration of the addIssuesToSprintTool in the central ToolRegistry during built-in tools initialization.this.registerTool(updateSprintTool); this.registerTool(addIssuesToSprintTool); this.registerTool(removeIssuesFromSprintTool);
- ToolDefinition export including name, description, schema reference, and usage examples for add_issues_to_sprint.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"] } } ] };
- Low-level helper that performs GraphQL mutation to update project item field value, assigning issues to sprint (iteration field). Called by public addIssue method.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", }, }); } }