Skip to main content
Glama

get_player_totals

Retrieve comprehensive Dota 2 player statistics using a Steam32 account ID to analyze performance metrics and gameplay patterns.

Instructions

Get player's overall stats totals.

Args:
    account_id: Steam32 account ID of the player

Returns:
    Summary of player's total stats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes

Implementation Reference

  • The get_player_totals tool handler. Decorated with @mcp.tool() for registration. Fetches player total statistics from the OpenDota API endpoint `/players/{account_id}/totals`, processes the data, and returns a formatted string summary of total and average stats for various metrics.
    @mcp.tool()
    async def get_player_totals(account_id: int) -> str:
        """Get player's overall stats totals.
    
        Args:
            account_id: Steam32 account ID of the player
    
        Returns:
            Summary of player's total stats
        """
        totals_data = await make_opendota_request(f"players/{account_id}/totals")
    
        if "error" in totals_data:
            return f"Error retrieving totals data: {totals_data['error']}"
    
        if not totals_data or not isinstance(totals_data, list) or len(totals_data) == 0:
            return "No totals data found for this player."
    
        # Extract important fields
        formatted_stats = []
    
        for stat in totals_data:
            field = stat.get("field", "")
            count = stat.get("n", 0)
            sum_value = stat.get("sum", 0)
            avg_value = sum_value / count if count > 0 else 0
    
            # Convert field name to something more readable
            readable_field = field.replace("_", " ").title()
    
            formatted_stats.append(
                f"{readable_field}: {sum_value:,} total, {avg_value:.2f} avg"
            )
    
        return f"Stat Totals for Player ID {account_id}:\n\n" + "\n".join(formatted_stats)

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