Skip to main content
Glama

get_champion_mastery_tool

Get a player's champion mastery details: level, points, and last play time for a specific champion.

Instructions

🎯 Get the player's mastery info for a specific champion.

Returns detailed mastery data (level, points, last play time, etc.) for the requested champion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
game_nameYes
tag_lineYes
champion_nameYes
languageNoen_US

Implementation Reference

  • The actual tool handler function. Takes game_name, tag_line, champion_name, language; resolves puuid via get_puuid(), finds champion ID from champion map, fetches mastery via Riot API, and returns detailed mastery data.
    async def get_champion_mastery_tool(game_name: str, tag_line: str, champion_name: str, language: str = "en_US") -> dict[str, Any] | str:
        """
        🎯 Get the player's mastery info for a specific champion.
    
        Returns detailed mastery data (level, points, last play time, etc.) for the requested champion.
        """
        puuid = await get_puuid(game_name, tag_line)
        if not puuid:
            return "Failed to find player."
    
        champion_map = await get_champion_map(language)
        champion_id = next((cid for cid, name in champion_map.items() if name.lower() == champion_name.lower()), None)
        if not champion_id:
            return f"Champion '{champion_name}' not found."
    
        mastery = await riot_request(
            f"/lol/champion-mastery/v4/champion-masteries/by-puuid/{puuid}/by-champion/{champion_id}"
        )
        if not mastery:
            return f"Could not find mastery data for {champion_name}."
    
        return {
            "game_name": game_name,
            "tag_line": tag_line,
            "puuid": puuid,
            "champion_name": champion_name,
            "champion_id": champion_id,
            "champion_mastery": mastery
        }
  • src/server.py:146-147 (registration)
    The @mcp.tool() decorator registering 'get_champion_mastery_tool' as an MCP tool.
    @mcp.tool()
    async def get_champion_mastery_tool(game_name: str, tag_line: str, champion_name: str, language: str = "en_US") -> dict[str, Any] | str:
  • The function signature and docstring define the input schema: game_name (str), tag_line (str), champion_name (str), language (str, default 'en_US'). Return type is dict[str, Any] | str.
    async def get_champion_mastery_tool(game_name: str, tag_line: str, champion_name: str, language: str = "en_US") -> dict[str, Any] | str:
        """
        🎯 Get the player's mastery info for a specific champion.
    
        Returns detailed mastery data (level, points, last play time, etc.) for the requested champion.
        """
  • get_puuid() helper used by the tool to convert game_name + tag_line to a Riot PUUID.
    async def get_puuid(game_name: str, tag_line: str) -> str | None:
        url = f"https://asia.api.riotgames.com/riot/account/v1/accounts/by-riot-id/{game_name}/{tag_line}"
        headers = {
            "X-Riot-Token": RIOT_API_KEY,
            "Content-Type": "application/json",
        }
        try:
            async with httpx.AsyncClient() as client:
                res = await client.get(url, headers=headers)
                res.raise_for_status()
                return res.json()["puuid"]
        except Exception:
            return None
  • get_champion_map() helper used by the tool to get a language-specific champion ID-to-name mapping.
    async def get_champion_map(language: str = "ko_KR") -> dict[int, str]:
        if language in CHAMPION_MAP:
            return CHAMPION_MAP[language]
    
        async with httpx.AsyncClient() as client:
            version_res = await client.get("https://ddragon.leagueoflegends.com/api/versions.json")
            version = version_res.json()[0]
            champ_res = await client.get(
                f"https://ddragon.leagueoflegends.com/cdn/{version}/data/{language}/champion.json"
            )
            data = champ_res.json()["data"]
            CHAMPION_MAP[language] = {int(c["key"]): c["name"] for c in data.values()}
            return CHAMPION_MAP[language]
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It states 'Returns detailed mastery data' but does not mention if the operation is read-only, required permissions, error conditions (e.g., champion not mastered), or rate limits. The description is too vague to fully inform the agent.

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 concise with two sentences and an emoji marker. It front-loads the core action and provides a brief output summary without unnecessary fluff.

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

Completeness2/5

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

Given the complexity of 4 parameters (3 required), no output schema, and no annotations, the description is insufficient. It omits input format details, output structure beyond examples, and error handling. A more complete description would clarify parameter usage and expected returns.

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

Parameters1/5

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

Schema description coverage is 0%, yet the description adds no information about any of the four parameters (game_name, tag_line, champion_name, language). It does not explain what values are expected or how they relate to the tool's operation.

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 tool's purpose: 'Get the player's mastery info for a specific champion.' It differentiates well from siblings (e.g., get_match_summary, get_top_champions_tool) by specifying champion-specific mastery data.

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?

No explicit guidance on when to use this tool versus alternatives, nor any prerequisites or when-not-to-use conditions. The description implies usage for querying mastery, but lacks exclusion criteria or contextual recommendations.

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/jifrozen0110/mcp-riot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server