Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

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
NameRequiredDescriptionDefault
iterationsYesAn array of iterations to assign. Each iteration must have an identifier and a path.
projectYesThe name or ID of the Azure DevOps project.
teamYesThe name or ID of the Azure DevOps team.

Implementation Reference

  • 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,
        };
      }
    }
  • 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."),
    },
  • 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,
          };
        }
      }
    );
  • 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",
    };
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ennuiii/DevOpsMcpPAT'

If you have feedback or need assistance with the MCP directory API, please join our Discord server