Skip to main content
Glama

get_player_rankings

Retrieve a player's hero rankings using their Steam32 account ID to analyze performance across different heroes in Dota 2 matches.

Instructions

Get player hero rankings.

Args: account_id: Steam32 account ID of the player Returns: Player's hero rankings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes

Implementation Reference

  • The primary handler function for the 'get_player_rankings' tool. It fetches hero rankings data for a given player account ID from the OpenDota API, maps hero IDs to names, and formats the results into a readable string response. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool() async def get_player_rankings(account_id: int) -> str: """Get player hero rankings. Args: account_id: Steam32 account ID of the player Returns: Player's hero rankings """ rankings_data = await make_opendota_request(f"players/{account_id}/rankings") if "error" in rankings_data: return f"Error retrieving rankings data: {rankings_data['error']}" if ( not rankings_data or not isinstance(rankings_data, list) or len(rankings_data) == 0 ): return "No ranking data found for this player." # Get hero names (just for context) heroes_data = await make_opendota_request("heroes") hero_id_to_name = {} if not isinstance(heroes_data, dict) and isinstance(heroes_data, list): for hero in heroes_data: if isinstance(hero, dict) and "id" in hero and "localized_name" in hero: hero_id = hero.get("id") hero_name = hero.get("localized_name") if hero_id is not None and hero_name is not None: hero_id_to_name[hero_id] = hero_name formatted_rankings = [] for ranking in rankings_data: hero_id = ranking.get("hero_id", 0) hero_name = hero_id_to_name.get(hero_id, f"Hero {hero_id}") score = ranking.get("score", 0) percent_rank = ranking.get("percent_rank", 0) * 100 # Convert to percentage formatted_rankings.append( f"{hero_name} (ID: {hero_id})\n" f"Score: {score:.2f}\n" f"Percentile: {percent_rank:.2f}%" ) return f"Hero Rankings for Player ID {account_id}:\n\n" + "\n\n".join( formatted_rankings )
  • The @mcp.tool() decorator registers the get_player_rankings function as an MCP tool.
    @mcp.tool()

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