get_match_summary
Retrieve a detailed summary of a specific match for a player, including KDA, damage, vision, and win/loss stats.
Instructions
📊 Get a detailed summary of a specific match for a given player.
Extracts and returns only the relevant stats (KDA, damage, vision, win/loss, etc.) from the match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| match_id | Yes | ||
| puuid | Yes |
Implementation Reference
- src/server.py:211-244 (handler)The handler function for the 'get_match_summary' tool. Decorated with @mcp.tool() to register it as an MCP tool. Fetches match data via Riot API, finds the participant by puuid, and returns detailed match statistics (KDA, damage, vision, game info).
@mcp.tool() async def get_match_summary(match_id: str, puuid: str) -> dict[str, Any] | str: """ 📊 Get a detailed summary of a specific match for a given player. Extracts and returns only the relevant stats (KDA, damage, vision, win/loss, etc.) from the match. """ match = await riot_request(f"/lol/match/v5/matches/{match_id}", region="asia") if not match: return "Failed to load match data." participant = next((p for p in match["info"]["participants"] if p["puuid"] == puuid), None) if not participant: return f"No participant found with puuid: {puuid}" return { "championName": participant["championName"], "lane": participant["lane"], "role": participant["role"], "kills": participant["kills"], "deaths": participant["deaths"], "assists": participant["assists"], "kda": participant["challenges"].get("kda"), "killParticipation": participant["challenges"].get("killParticipation"), "totalDamageDealtToChampions": participant["totalDamageDealtToChampions"], "visionScore": participant["visionScore"], "wardsPlaced": participant["wardsPlaced"], "wardsKilled": participant["wardsKilled"], "win": participant["win"], "teamPosition": participant.get("teamPosition"), "timePlayed": participant["timePlayed"], "gameDuration": match["info"]["gameDuration"], "queueId": match["info"]["queueId"], } - src/server.py:211-211 (registration)Registration via the @mcp.tool() decorator on the get_match_summary function, using FastMCP.
@mcp.tool() - src/server.py:18-33 (helper)Helper function used by get_match_summary to make authenticated requests to the Riot Games API.
async def riot_request( url: str, region: str = "kr", params: dict[str, Any] | None = None ) -> dict[str, Any] | None: headers = { "X-Riot-Token": RIOT_API_KEY, "Content-Type": "application/json", } async with httpx.AsyncClient() as client: try: full_url = f"https://{region}.api.riotgames.com{url}" res = await client.get(full_url, headers=headers, params=params, timeout=30.0) res.raise_for_status() return res.json() except Exception as e: print(f"Riot API Error: {e}") return None - src/server.py:226-244 (schema)Implicit schema defined by the returned dictionary in the handler. The input schema is defined via function parameters (match_id: str, puuid: str).
return { "championName": participant["championName"], "lane": participant["lane"], "role": participant["role"], "kills": participant["kills"], "deaths": participant["deaths"], "assists": participant["assists"], "kda": participant["challenges"].get("kda"), "killParticipation": participant["challenges"].get("killParticipation"), "totalDamageDealtToChampions": participant["totalDamageDealtToChampions"], "visionScore": participant["visionScore"], "wardsPlaced": participant["wardsPlaced"], "wardsKilled": participant["wardsKilled"], "win": participant["win"], "teamPosition": participant.get("teamPosition"), "timePlayed": participant["timePlayed"], "gameDuration": match["info"]["gameDuration"], "queueId": match["info"]["queueId"], }