assign_items_to_iteration
Assign multiple project items to a specific iteration for organized sprint planning and milestone tracking in GitHub Projects.
Instructions
Bulk assign multiple items to a specific iteration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| itemIds | Yes | ||
| iterationId | Yes | ||
| fieldName | No |
Implementation Reference
- Main handler function that implements the assign_items_to_iteration tool. Finds the iteration field in the project, then bulk assigns the specified item IDs to the given iteration ID by calling setFieldValue for each item.async assignItemsToIteration(data: { projectId: string; itemIds: string[]; iterationId: string; fieldName?: string; }): Promise<{ success: boolean; assignedCount: number }> { try { // Get iteration field const fields = await this.listProjectFields({ projectId: data.projectId }); const iterationField = fields.find((f: CustomField) => f.type === 'iteration' && (!data.fieldName || f.name === data.fieldName) ); if (!iterationField) { throw new ResourceNotFoundError( ResourceType.FIELD, data.fieldName || 'iteration field' ); } let assignedCount = 0; // Assign each item to the iteration for (const itemId of data.itemIds) { try { await this.setFieldValue({ projectId: data.projectId, itemId: itemId, fieldId: iterationField.id, value: { iterationId: data.iterationId } }); assignedCount++; } catch (error) { // Log error but continue with other items console.error(`Failed to assign item ${itemId}:`, error); } } return { success: assignedCount > 0, assignedCount }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- Tool definition including name, description, input schema (assignItemsToIterationSchema), and usage examples.export const assignItemsToIterationTool: ToolDefinition<AssignItemsToIterationArgs> = { name: "assign_items_to_iteration", description: "Bulk assign multiple items to a specific iteration", schema: assignItemsToIterationSchema as unknown as ToolSchema<AssignItemsToIterationArgs>, examples: [ { name: "Assign to sprint", description: "Add multiple issues to the current sprint", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH", itemIds: ["PVTI_lADOLhQ7gc4AOEbHzM4AOAJ7", "PVTI_lADOLhQ7gc4AOEbHzM4AOAJ8"], iterationId: "PVTIF_lADOLhQ7gc4AOEbH" } } ] };
- Zod input validation schema defining parameters: projectId, itemIds (array), iterationId, optional fieldName.// Schema for assign_items_to_iteration tool export const assignItemsToIterationSchema = z.object({ projectId: z.string().min(1, "Project ID is required"), itemIds: z.array(z.string()).min(1, "At least one item ID is required"), iterationId: z.string().min(1, "Iteration ID is required"), fieldName: z.string().optional() }); export type AssignItemsToIterationArgs = z.infer<typeof assignItemsToIterationSchema>;
- src/infrastructure/tools/ToolRegistry.ts:292-292 (registration)Registers the assignItemsToIterationTool in the central ToolRegistry singleton.this.registerTool(assignItemsToIterationTool);
- src/infrastructure/tools/ToolRegistry.ts:108-108 (registration)Imports assignItemsToIterationTool from ToolSchemas.ts for registration.assignItemsToIterationTool,
- src/index.ts:500-501 (handler)MCP server dispatch: routes tool calls to ProjectManagementService.assignItemsToIteration.case "assign_items_to_iteration": return await this.service.assignItemsToIteration(args);