Skip to main content
Glama

get_player_recent_matches

Retrieve recent Dota 2 match data for a specific player using their Steam32 account ID to analyze performance and gameplay patterns.

Instructions

Get recent matches played by a player.

Args:
    account_id: Steam32 account ID of the player
    limit: Number of matches to retrieve (default: 5)

Returns:
    List of recent matches with details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function implementing the 'get_player_recent_matches' tool. It fetches recent matches data from the OpenDota API using make_opendota_request, processes up to the specified limit of matches, formats key statistics like hero, KDA, GPM/XPM, result, and returns a formatted string summary. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool()
    async def get_player_recent_matches(account_id: int, limit: int = 5) -> str:
        """Get recent matches played by a player.
    
        Args:
            account_id: Steam32 account ID of the player
            limit: Number of matches to retrieve (default: 5)
    
        Returns:
            List of recent matches with details
        """
        if limit > 20:
            limit = 20  # Cap for reasonable response size
    
        recent_matches = await make_opendota_request(f"players/{account_id}/recentMatches")
    
        if "error" in recent_matches:
            return f"Error retrieving recent matches: {recent_matches['error']}"
    
        if (
            not recent_matches
            or not isinstance(recent_matches, list)
            or len(recent_matches) == 0
        ):
            return "No recent matches found for this player."
    
        formatted_matches = []
    
        matches_to_process = []
        if isinstance(recent_matches, list):
            matches_to_process = recent_matches[:limit]
        for i, match in enumerate(matches_to_process):
            hero_id = match.get("hero_id", "Unknown")
            kills = match.get("kills", 0)
            deaths = match.get("deaths", 0)
            assists = match.get("assists", 0)
            win = (
                "Won"
                if (match.get("radiant_win") == (match.get("player_slot", 0) < 128))
                else "Lost"
            )
            gpm = match.get("gold_per_min", 0)
            xpm = match.get("xp_per_min", 0)
            match_date = format_timestamp(match.get("start_time", 0))
            duration = format_duration(match.get("duration", 0))
    
            formatted_matches.append(
                f"Match {i+1}:\n"
                f"- Match ID: {match.get('match_id')}\n"
                f"- Date: {match_date}\n"
                f"- Duration: {duration}\n"
                f"- Hero ID: {hero_id}\n"
                f"- K/D/A: {kills}/{deaths}/{assists}\n"
                f"- GPM/XPM: {gpm}/{xpm}\n"
                f"- Result: {win}"
            )
    
        return f"Recent Matches for Player ID {account_id}:\n\n" + "\n\n".join(
            formatted_matches
        )
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the return type ('List of recent matches with details') but doesn't disclose behavioral traits like rate limits, authentication needs, data freshness, error conditions, or pagination behavior for the limit parameter.

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 efficiently structured with a clear purpose statement followed by well-organized Arg and Return sections. Every sentence earns its place, and information is front-loaded appropriately.

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 simple 2-parameter tool with an output schema (which handles return value documentation), the description is reasonably complete. It covers purpose and parameters adequately, though could benefit from more behavioral context given the lack of annotations.

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?

With 0% schema description coverage, the description compensates well by explaining both parameters: 'account_id' as the Steam32 account ID and 'limit' as the number of matches with a default value. This adds crucial meaning beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Get recent matches played by a player'), identifies the resource ('matches'), and distinguishes from siblings by focusing on recent matches for a specific player rather than general match data, hero stats, or other player metrics.

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

Usage Guidelines3/5

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

The description implies usage when needing recent matches for a specific player, but doesn't explicitly state when to use this vs. alternatives like 'get_match_data' (for specific match details) or 'get_player_totals' (for aggregated stats). No exclusions or prerequisites are mentioned.

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