work_assign_iterations
Assign existing iterations to a specific team in an Azure DevOps project, using the project name/ID, team name/ID, and iteration details to streamline iteration management.
Instructions
Assign existing iterations to a specific team in a project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iterations | Yes | An array of iterations to assign. Each iteration must have an identifier and a path. | |
| project | Yes | The name or ID of the Azure DevOps project. | |
| team | Yes | The name or ID of the Azure DevOps team. |
Implementation Reference
- src/tools/work.ts:122-152 (handler)The handler function that executes the tool logic: assigns iterations to a team using Azure DevOps Work API's postTeamIteration method.async ({ project, team, iterations }) => { try { const connection = await connectionProvider(); const workApi = await connection.getWorkApi(); const teamContext = { project, team }; const results = []; for (const { identifier, path } of iterations) { const assignment = await workApi.postTeamIteration({ path: path, id: identifier }, teamContext); if (assignment) { results.push(assignment); } } if (results.length === 0) { return { content: [{ type: "text", text: "No iterations were assigned to the team" }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error assigning iterations: ${errorMessage}` }], isError: true, }; } }
- src/tools/work.ts:110-121 (schema)Input schema using Zod validators for project name/ID, team name/ID, and array of iterations (each with identifier and path).{ project: z.string().describe("The name or ID of the Azure DevOps project."), team: z.string().describe("The name or ID of the Azure DevOps team."), iterations: z .array( z.object({ identifier: z.string().describe("The identifier of the iteration to assign."), path: z.string().describe("The path of the iteration to assign, e.g., 'Project/Iteration'."), }) ) .describe("An array of iterations to assign. Each iteration must have an identifier and a path."), },
- src/tools/work.ts:107-153 (registration)Tool registration call to server.tool() with name WORK_TOOLS.assign_iterations ("work_assign_iterations"), description, schema, and handler.server.tool( WORK_TOOLS.assign_iterations, "Assign existing iterations to a specific team in a project.", { project: z.string().describe("The name or ID of the Azure DevOps project."), team: z.string().describe("The name or ID of the Azure DevOps team."), iterations: z .array( z.object({ identifier: z.string().describe("The identifier of the iteration to assign."), path: z.string().describe("The path of the iteration to assign, e.g., 'Project/Iteration'."), }) ) .describe("An array of iterations to assign. Each iteration must have an identifier and a path."), }, async ({ project, team, iterations }) => { try { const connection = await connectionProvider(); const workApi = await connection.getWorkApi(); const teamContext = { project, team }; const results = []; for (const { identifier, path } of iterations) { const assignment = await workApi.postTeamIteration({ path: path, id: identifier }, teamContext); if (assignment) { results.push(assignment); } } if (results.length === 0) { return { content: [{ type: "text", text: "No iterations were assigned to the team" }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error assigning iterations: ${errorMessage}` }], isError: true, }; } } );
- src/tools/work.ts:10-14 (registration)Constant mapping internal function names to tool names, including assign_iterations: "work_assign_iterations".const WORK_TOOLS = { list_team_iterations: "work_list_team_iterations", create_iterations: "work_create_iterations", assign_iterations: "work_assign_iterations", };