get_pro_players
Retrieve professional Dota 2 player data to analyze competitive scene trends and identify top performers.
Instructions
Get list of professional players.
Args:
limit: Number of players to retrieve (default: 10)
Returns:
List of professional players
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/opendota_server/server.py:760-807 (handler)The @mcp.tool() decorated handler function that implements the get_pro_players tool. It fetches professional players from the OpenDota API endpoint 'proPlayers', sorts them by team/name/account_id, limits the output, and formats a readable list of pro players with their team, country, and account ID.@mcp.tool() async def get_pro_players(limit: int = 10) -> str: """Get list of professional players. Args: limit: Number of players to retrieve (default: 10) Returns: List of professional players """ if limit > 30: limit = 30 # Cap for reasonable response size pro_players = await make_opendota_request("proPlayers") if "error" in pro_players: return f"Error retrieving pro players: {pro_players['error']}" if not pro_players or not isinstance(pro_players, list) or len(pro_players) == 0: return "No professional players found." # Sort by name for consistency sorted_players = sorted( pro_players, key=lambda x: ( x.get("team_name", ""), x.get("name", ""), x.get("account_id", 0), ), ) formatted_players = [] for i, player in enumerate(sorted_players[:limit]): account_id = player.get("account_id", "Unknown") name = player.get("name", "Anonymous") team_name = player.get("team_name", "No Team") country_code = player.get("country_code", "Unknown") formatted_players.append( f"{i+1}. {name}\n" f" Team: {team_name}\n" f" Country: {country_code}\n" f" Account ID: {account_id}" ) return "Professional Players:\n\n" + "\n\n".join(formatted_players)