Skip to main content
Glama

get_player_items

Retrieve a player's in-game item list in League of Legends by providing their Riot ID. This tool communicates with the Live Client Data API to fetch and display active player item details.

Instructions

Retrieve the list of items for the player.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
riot_idYes

Implementation Reference

  • main.py:165-173 (handler)
    The main handler function for the 'get_player_items' tool. It is decorated with @mcp.tool() for registration and @with_timeout for error handling. Fetches the player's items from the League of Legends live client API endpoint `/liveclientdata/playeritems` using the provided riot_id.
    @mcp.tool() @with_timeout async def get_player_items(riot_id: str) -> list[dict]: """ Retrieve the list of items for the player. """ async with get_lol_client() as client: response = await client.get(f"/liveclientdata/playeritems?riotId={riot_id}") return response.json()
  • main.py:50-59 (helper)
    Helper function to create an HTTP client connected to the LoL client API, used by get_player_items and other tools.
    def get_lol_client(): """ Create an HTTP client for the League of Legends client. """ return httpx.AsyncClient( base_url=LOL_CLIENT_HOST, verify="./certs/riotgames.pem", timeout=DEFAULT_TIMEOUT )
  • main.py:18-47 (helper)
    Decorator applied to the tool handler for handling various HTTP errors and timeouts gracefully.
    def with_timeout(func: Callable[..., Awaitable[T]]) -> Callable[..., Awaitable[T]]: """ Decorator to handle timeout exceptions for async functions. """ @functools.wraps(func) async def wrapper(*args: Any, **kwargs: Any) -> T: try: return await func(*args, **kwargs) except httpx.TimeoutException: return { "error": "Game has not started or connection failed.", "code": "TIMEOUT" } except httpx.ConnectError: return { "error": "Cannot connect to the game client. Please check if the game is running.", "code": "CONNECTION_ERROR" } except httpx.HTTPStatusError as e: return { "error": f"Server error: HTTP {e.response.status_code}", "code": "HTTP_ERROR", "status": e.response.status_code } except Exception as e: return { "error": f"An error occurred: {str(e)}", "code": "UNKNOWN_ERROR" } return wrapper

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/johnnyinlee/lol-client-mcp'

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