get_team_info
Retrieve detailed Dota 2 team statistics and information using a specific team ID to analyze team performance and composition.
Instructions
Get information about a team.
Args:
team_id: Team ID
Returns:
Team information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| team_id | Yes |
Implementation Reference
- src/opendota_server/server.py:1066-1123 (handler)The get_team_info tool handler, decorated with @mcp.tool() for registration. Fetches team data and player data from OpenDota API, computes statistics like win rate, and returns a formatted string with team info 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}" )
- src/opendota_server/server.py:1066-1066 (registration)The @mcp.tool() decorator registers the get_team_info function as an MCP tool.@mcp.tool()