get_team_iterations
Retrieve sprint schedules and date ranges for Azure DevOps teams to view iteration calendars, identify active sprints, and plan work based on time periods.
Instructions
Retrieves the iterations (sprints) assigned to a specific team.
Use this tool when you need to:
- View a team's sprint schedule
- Find date ranges for iterations
- Determine which iteration is currently active
- Plan work based on team's iteration calendar
IMPORTANT: Iterations in Azure DevOps define time periods for planning
and tracking work. They determine sprint dates and are used for
capacity planning, burndown charts, and velocity calculations.
Args:
project_name_or_id: The name or ID of the team project
team_name_or_id: The name or ID of the team
current: If True, return only the current iteration
Returns:
Formatted string containing team iteration information including
names, date ranges, and time frames (past/current/future),
formatted as markdown
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name_or_id | Yes | ||
| team_name_or_id | Yes | ||
| current | No |
Implementation Reference
- The primary MCP tool handler for the 'get_team_iterations' tool. This function is decorated with @mcp.tool() and implements the tool logic by obtaining the Azure DevOps work client and delegating to the helper implementation function.@mcp.tool() def get_team_iterations( project_name_or_id: str, team_name_or_id: str, current: Optional[bool] = None ) -> str: """ Retrieves the iterations (sprints) assigned to a specific team. Use this tool when you need to: - View a team's sprint schedule - Find date ranges for iterations - Determine which iteration is currently active - Plan work based on team's iteration calendar IMPORTANT: Iterations in Azure DevOps define time periods for planning and tracking work. They determine sprint dates and are used for capacity planning, burndown charts, and velocity calculations. Args: project_name_or_id: The name or ID of the team project team_name_or_id: The name or ID of the team current: If True, return only the current iteration Returns: Formatted string containing team iteration information including names, date ranges, and time frames (past/current/future), formatted as markdown """ try: work_client = get_work_client() return _get_team_iterations_impl( work_client, project_name_or_id, team_name_or_id, current ) except AzureDevOpsClientError as e: return f"Error: {str(e)}"
- Core helper function that performs the actual API call to retrieve team iterations using the Azure DevOps SDK, formats them, and handles errors.def _get_team_iterations_impl( work_client, project_name_or_id: str, team_name_or_id: str, current: Optional[bool] = None ) -> str: """ Implementation of team iterations retrieval. Args: work_client: Work client project_name_or_id: The name or ID of the team project team_name_or_id: The name or ID of the team current: If True, return only the current iteration Returns: Formatted string containing team iteration information """ try: # Create a TeamContext object team_context = TeamContext( project=project_name_or_id, team=team_name_or_id ) # Set timeframe parameter if current is True timeframe = "Current" if current else None # Get the team iterations team_iterations = work_client.get_team_iterations( team_context=team_context, timeframe=timeframe ) if not team_iterations: return (f"No iterations found for team {team_name_or_id} " f"in project {project_name_or_id}.") formatted_iterations = [] for iteration in team_iterations: formatted_iterations.append(_format_team_iteration(iteration)) return "\n\n".join(formatted_iterations) except Exception as e: return f"Error retrieving team iterations: {str(e)}"
- Supporting helper function to format individual team iteration data into a readable markdown string.def _format_team_iteration(iteration) -> str: """ Format team iteration information. Args: iteration: Team iteration object to format Returns: String with team iteration details """ formatted_info = [f"# Iteration: {iteration.name}"] # Add ID if hasattr(iteration, "id") and iteration.id: formatted_info.append(f"ID: {iteration.id}") # Add path if hasattr(iteration, "path") and iteration.path: formatted_info.append(f"Path: {iteration.path}") # Add attributes if available if hasattr(iteration, "attributes") and iteration.attributes: attributes = iteration.attributes # Add start date if hasattr(attributes, "start_date") and attributes.start_date: formatted_info.append(f"Start Date: {attributes.start_date}") # Add finish date if hasattr(attributes, "finish_date") and attributes.finish_date: formatted_info.append(f"Finish Date: {attributes.finish_date}") # Add time frame if hasattr(attributes, "time_frame") and attributes.time_frame: formatted_info.append(f"Time Frame: {attributes.time_frame}") return "\n".join(formatted_info)
- src/mcp_azure_devops/features/teams/__init__.py:5-13 (registration)Feature-level registration function that calls tools.register_tools(mcp) to register all teams tools, including 'get_team_iterations'.def register(mcp): """ Register all teams components with the MCP server. Args: mcp: The FastMCP server instance """ tools.register_tools(mcp)