get_pro_matches
Retrieve recent professional Dota 2 matches to analyze competitive gameplay trends and professional team strategies.
Instructions
Get recent professional matches.
Args:
limit: Number of matches to retrieve (default: 5)
Returns:
List of recent professional matches
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/opendota_server/server.py:809-857 (handler)Implementation of the get_pro_matches tool handler. This async function fetches recent pro matches from the OpenDota API using make_opendota_request, processes and formats up to 20 matches (capped), and returns a formatted string list. Registered as an MCP tool via @mcp.tool() decorator.@mcp.tool() async def get_pro_matches(limit: int = 5) -> str: """Get recent professional matches. Args: limit: Number of matches to retrieve (default: 5) Returns: List of recent professional matches """ if limit > 20: limit = 20 # Cap for reasonable response size pro_matches = await make_opendota_request("proMatches") if "error" in pro_matches: return f"Error retrieving pro matches: {pro_matches['error']}" if not pro_matches or not isinstance(pro_matches, list) or len(pro_matches) == 0: return "No professional matches found." formatted_matches = [] # Limit the matches to display matches_to_show = [] if isinstance(pro_matches, list): matches_to_show = pro_matches[:limit] for i, match in enumerate(matches_to_show): match_id = match.get("match_id", "Unknown") radiant_name = match.get("radiant_name", "Radiant") dire_name = match.get("dire_name", "Dire") league_name = match.get("league_name", "Unknown League") duration = format_duration(match.get("duration", 0)) start_time = format_timestamp(match.get("start_time", 0)) radiant_score = match.get("radiant_score", 0) dire_score = match.get("dire_score", 0) winner = radiant_name if match.get("radiant_win", False) else dire_name formatted_matches.append( f"{i+1}. {radiant_name} vs {dire_name}\n" f" Match ID: {match_id}\n" f" League: {league_name}\n" f" Date: {start_time}\n" f" Duration: {duration}\n" f" Score: {radiant_score} - {dire_score}\n" f" Winner: {winner}" ) return "Recent Professional Matches:\n\n" + "\n\n".join(formatted_matches)