get_all_teams
Retrieve and list all teams in an Azure DevOps organization with details like names, IDs, and projects. Filter results by user membership, set limits, or skip entries for tailored team overviews.
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 |
|---|---|---|---|
| skip | No | ||
| top | No | ||
| user_is_member_of | No |
Implementation Reference
- The primary handler function for the MCP tool 'get_all_teams', decorated with @mcp.tool(). It obtains the CoreClient and calls the helper implementation.@mcp.tool() 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)}"
- The _get_all_teams_impl helper that performs the actual API call to core_client.get_all_teams() with parameters, formats results using _format_team, and handles 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)}"
- The _format_team helper function used to format individual team information into a readable string.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)The register() function in the teams feature package that calls tools.register_tools(mcp) to register the get_all_teams tool among 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/__init__.py:12-15 (registration)Top-level features registration that includes teams.register(mcp), enabling the get_all_teams tool.work_items.register(mcp) projects.register(mcp) teams.register(mcp)