Skip to main content
Glama

get_team_info

Retrieve detailed statistics and information about Dota 2 teams using their unique team ID to access performance data, roster details, and match history.

Instructions

Get information about a team.

Args:
    team_id: Team ID

Returns:
    Team information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team_idYes

Implementation Reference

  • The complete handler function for the 'get_team_info' MCP tool. It is registered via the @mcp.tool() decorator, fetches team details and current players from the OpenDota API using make_opendota_request, processes the data, and returns a formatted string summary of the team information including rating, win/loss record, last match time, and current players.
    @mcp.tool()
    async def get_team_info(team_id: int) -> str:
        """Get information about a team.
    
        Args:
            team_id: Team ID
    
        Returns:
            Team information
        """
        team_data = await make_opendota_request(f"teams/{team_id}")
    
        if "error" in team_data:
            return f"Error retrieving team data: {team_data['error']}"
    
        if not team_data or not isinstance(team_data, dict):
            return f"No data found for team ID {team_id}."
    
        team_name = team_data.get("name", "Unknown")
        team_tag = team_data.get("tag", "")
        rating = team_data.get("rating", 0)
        wins = team_data.get("wins", 0)
        losses = team_data.get("losses", 0)
        total_games = wins + losses
        win_rate = (wins / total_games * 100) if total_games > 0 else 0
        last_match_time = format_timestamp(team_data.get("last_match_time", 0))
    
        # Get team players
        players_data = await make_opendota_request(f"teams/{team_id}/players")
    
        formatted_players = []
        if isinstance(players_data, list) and players_data:
            current_players = [p for p in players_data if p.get("is_current_team_member")]
    
            for player in current_players:
                player_name = player.get("name", "Unknown")
                account_id = player.get("account_id", "Unknown")
                games_played = player.get("games_played", 0)
                wins = player.get("wins", 0)
                win_rate = (wins / games_played * 100) if games_played > 0 else 0
    
                formatted_players.append(
                    f"{player_name} (ID: {account_id})\n"
                    f"Games: {games_played}, Win Rate: {win_rate:.2f}%"
                )
    
        players_section = (
            "\n\nCurrent Players:\n" + "\n".join(formatted_players)
            if formatted_players
            else ""
        )
    
        return (
            f"Team: {team_name} [{team_tag}] (ID: {team_id})\n"
            f"Rating: {rating}\n"
            f"Record: {wins}-{losses} ({win_rate:.2f}% win rate)\n"
            f"Last Match: {last_match_time}{players_section}"
        )

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/asusevski/opendota-mcp-server'

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