get_all_teams
Retrieve all teams in your Azure DevOps organization to get an overview of team names, IDs, and associated projects for operational use.
Instructions
Retrieves all teams in the Azure DevOps organization.
Use this tool when you need to:
- Get an overview of all teams across projects
- Find team IDs for use in other operations
- Determine which teams exist in the organization
- Locate specific teams by name
Args:
user_is_member_of: If true, return only teams where the current
user is a member. Otherwise return all teams the user
has read access to.
top: Maximum number of teams to return
skip: Number of teams to skip
Returns:
Formatted string containing team information including names,
IDs, descriptions, and associated projects, formatted as
markdown with each team clearly separated
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_is_member_of | No | ||
| top | No | ||
| skip | No |
Implementation Reference
- The primary MCP tool handler function for 'get_all_teams', decorated with @mcp.tool(). It retrieves the CoreClient and calls the internal implementation _get_all_teams_impl, handling AzureDevOpsClientError.def get_all_teams( user_is_member_of: Optional[bool] = None, top: Optional[int] = None, skip: Optional[int] = None ) -> str: """ Retrieves all teams in the Azure DevOps organization. Use this tool when you need to: - Get an overview of all teams across projects - Find team IDs for use in other operations - Determine which teams exist in the organization - Locate specific teams by name Args: user_is_member_of: If true, return only teams where the current user is a member. Otherwise return all teams the user has read access to. top: Maximum number of teams to return skip: Number of teams to skip Returns: Formatted string containing team information including names, IDs, descriptions, and associated projects, formatted as markdown with each team clearly separated """ try: core_client = get_core_client() return _get_all_teams_impl( core_client, user_is_member_of, top, skip ) except AzureDevOpsClientError as e: return f"Error: {str(e)}"
- Core helper function implementing the logic to fetch all teams using Azure DevOps CoreClient.get_all_teams(), format each team with _format_team, and handle errors.def _get_all_teams_impl( core_client: CoreClient, user_is_member_of: Optional[bool] = None, top: Optional[int] = None, skip: Optional[int] = None, expand_identity: Optional[bool] = None ) -> str: """ Implementation of teams retrieval. Args: core_client: Core client user_is_member_of: If true, then return all teams requesting user is member. Otherwise return all teams user has read access. top: Maximum number of teams to return skip: Number of teams to skip Returns: Formatted string containing team information """ try: # Call the SDK function - note we're mapping user_is_member_of to mine # param teams = core_client.get_all_teams( mine=user_is_member_of, top=top, skip=skip ) if not teams: return "No teams found." formatted_teams = [] for team in teams: formatted_teams.append(_format_team(team)) return "\n\n".join(formatted_teams) except Exception as e: return f"Error retrieving teams: {str(e)}"
- Helper function to format individual team information into a markdown string, used by _get_all_teams_impl.def _format_team(team: WebApiTeam) -> str: """ Format team information. Args: team: Team object to format Returns: String with team details """ # Basic information that should always be available formatted_info = [f"# Team: {team.name}"] formatted_info.append(f"ID: {team.id}") # Add description if available if hasattr(team, "description") and team.description: formatted_info.append(f"Description: {team.description}") # Add project information if available if hasattr(team, "project_name") and team.project_name: formatted_info.append(f"Project: {team.project_name}") if hasattr(team, "project_id") and team.project_id: formatted_info.append(f"Project ID: {team.project_id}") return "\n".join(formatted_info)
- src/mcp_azure_devops/features/teams/__init__.py:5-13 (registration)Registration entry point for the teams feature, which calls tools.register_tools(mcp) to register the get_all_teams tool and others.def register(mcp): """ Register all teams components with the MCP server. Args: mcp: The FastMCP server instance """ tools.register_tools(mcp)
- src/mcp_azure_devops/features/teams/tools.py:331-339 (registration)The register_tools function that defines and registers the get_all_teams tool using @mcp.tool() decorator when called.def register_tools(mcp) -> None: """ Register team tools with the MCP server. Args: mcp: The FastMCP server instance """ @mcp.tool()