Skip to main content
Glama

get_player_recent_matches

Retrieve recent Dota 2 match history for any player using their Steam account ID to analyze performance, track gameplay patterns, and review match outcomes.

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

Implementation Reference

  • The core handler function decorated with @mcp.tool(), which registers and implements 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 (capped at 20), formats match details including hero, KDA, GPM/XPM, date, duration, and win/loss, and returns a formatted string summary.
    @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 )

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