Skip to main content
Glama

get_match_heroes

Retrieve hero selections for any Dota 2 match by entering the match ID to analyze team compositions and player choices.

Instructions

Get heroes played in a specific match.

Args:
    match_id: ID of the match to retrieve

Returns:
    List of heroes played by each player in the match

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
match_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'get_match_heroes' tool. It is registered via the @mcp.tool() decorator. Fetches match data from the OpenDota API, maps hero IDs to names, processes player data to list heroes for Radiant and Dire teams with player names and K/D/A stats, and formats the output string.
    @mcp.tool()
    async def get_match_heroes(match_id: int) -> str:
        """Get heroes played in a specific match.
    
        Args:
            match_id: ID of the match to retrieve
    
        Returns:
            List of heroes played by each player in the match
        """
        match_data = await make_opendota_request(f"matches/{match_id}")
    
        if "error" in match_data:
            return f"Error retrieving match data: {match_data['error']}"
    
        if not match_data or "players" not in match_data:
            return f"No data found for match ID {match_id}."
    
        # Get hero names
        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
    
        # Process players
        radiant_players = []
        dire_players = []
    
        for player in match_data["players"]:
            hero_id = player.get("hero_id", 0)
            hero_name = hero_id_to_name.get(hero_id, f"Hero {hero_id}")
            account_id = player.get("account_id", "Anonymous")
            name = player.get("personaname", "Unknown")
            kills = player.get("kills", 0)
            deaths = player.get("deaths", 0)
            assists = player.get("assists", 0)
    
            player_info = (
                f"{name} (ID: {account_id}) - {hero_name}: {kills}/{deaths}/{assists}"
            )
    
            if player.get("player_slot", 0) < 128:
                radiant_players.append(player_info)
            else:
                dire_players.append(player_info)
    
        # Match result
        radiant_win = match_data.get("radiant_win", False)
        result = "Radiant Victory" if radiant_win else "Dire Victory"
    
        return (
            f"Heroes in Match {match_id} ({result}):\n\n"
            f"Radiant:\n" + "\n".join(f"- {p}" for p in radiant_players) + "\n\n"
            "Dire:\n" + "\n".join(f"- {p}" for p in dire_players)
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get heroes'), implying a read-only operation, but doesn't cover aspects like error handling, rate limits, authentication needs, or data freshness. This leaves significant gaps for a tool that likely queries a match database.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose, followed by clear sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers the purpose and parameter semantics adequately. However, the lack of usage guidelines and behavioral details (e.g., error cases) prevents a perfect score, as these are important for reliable tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter 'match_id' by specifying it as 'ID of the match to retrieve', which clarifies its purpose beyond the schema's basic type (integer). With 0% schema description coverage and only one parameter, this compensation is effective, though it doesn't detail format constraints (e.g., valid ID ranges).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('heroes played in a specific match'), making it easy to understand what it does. However, it doesn't explicitly distinguish this from sibling tools like 'get_match_data' or 'get_player_heroes', which might have overlapping functionality, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_match_data' and 'get_player_heroes' available, there's no indication of context, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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