Skip to main content
Glama
pab1it0

Chess.com MCP Server

get_titled_players

Retrieve a list of Chess.com players with a specific chess title, such as GM or IM, by providing the title abbreviation.

Instructions

Get a list of titled players from Chess.com

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_titled_players' tool. Decorated with @mcp.tool, it validates the title against a list of valid chess titles, raises ValueError if invalid, and calls make_api_request to fetch titled players from the Chess.com API endpoint 'titled/{title}'.
    @mcp.tool(description="Get a list of titled players from Chess.com")
    async def get_titled_players(title: str) -> Dict[str, Any]:
        """
        Get a list of titled players from Chess.com.
    
        Args:
            title: Chess title (GM, WGM, IM, WIM, FM, WFM, NM, WNM, CM, WCM)
    
        Returns:
            List of titled players
    
        Raises:
            ValueError: If the title is not valid
        """
        valid_titles = ["GM", "WGM", "IM", "WIM", "FM", "WFM", "NM", "WNM", "CM", "WCM"]
        if title not in valid_titles:
            error_msg = f"Invalid title. Must be one of: {', '.join(valid_titles)}"
            logger.error("Invalid title provided", title=title, valid_titles=valid_titles)
            raise ValueError(error_msg)
    
        logger.info("Fetching titled players", title=title)
        return await make_api_request(f"titled/{title}")
  • Registration of the tool via the @mcp.tool decorator with description 'Get a list of titled players from Chess.com'.
    @mcp.tool(description="Get a list of titled players from Chess.com")
  • Input validation schema: defines valid_titles list (GM, WGM, IM, WIM, FM, WFM, NM, WNM, CM, WCM) and raises ValueError with guidance if an invalid title is provided.
    valid_titles = ["GM", "WGM", "IM", "WIM", "FM", "WFM", "NM", "WNM", "CM", "WCM"]
    if title not in valid_titles:
        error_msg = f"Invalid title. Must be one of: {', '.join(valid_titles)}"
        logger.error("Invalid title provided", title=title, valid_titles=valid_titles)
        raise ValueError(error_msg)
  • The make_api_request helper function that performs the actual HTTP call to the Chess.com API. Used by get_titled_players to fetch data from 'titled/{title}' endpoint.
    async def make_api_request(
        endpoint: str,
        params: Optional[Dict[str, Any]] = None,
        accept_json: bool = True
    ) -> Union[Dict[str, Any], str]:
        """
        Make a request to the Chess.com API.
    
        Args:
            endpoint: The API endpoint to request
            params: Optional query parameters
            accept_json: Whether to accept JSON response (True) or PGN (False)
    
        Returns:
            JSON response as dict or text response as string
    
        Raises:
            httpx.HTTPError: If the request fails
        """
        url = f"{config.base_url}/{endpoint}"
        headers = {
            "accept": "application/json" if accept_json else "application/x-chess-pgn"
        }
    
        logger.debug(
            "Making API request",
            endpoint=endpoint,
            url=url,
            accept_json=accept_json,
            has_params=params is not None
        )
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params or {})
                response.raise_for_status()
    
                if accept_json:
                    result = response.json()
                    logger.debug("API request successful", endpoint=endpoint, response_type="json")
                    return result
                else:
                    result = response.text
                    logger.debug("API request successful", endpoint=endpoint, response_type="text")
                    return result
    
            except httpx.HTTPError as e:
                logger.error(
                    "API request failed",
                    endpoint=endpoint,
                    url=url,
                    error=str(e),
                    error_type=type(e).__name__
                )
                raise
  • The titled_players_resource function (a @mcp.resource) that wraps get_titled_players to provide it as a resource at 'chess://titled/{title}', returning JSON-formatted results.
    @mcp.resource("chess://titled/{title}")
    async def titled_players_resource(title: str) -> str:
        """
        Resource that returns a list of titled players.
    
        Args:
            title: Chess title (GM, WGM, IM, WIM, FM, WFM, NM, WNM, CM, WCM)
    
        Returns:
            JSON-formatted titled players list
        """
        try:
            import json
            logger.debug("Fetching titled players resource", title=title)
            players = await get_titled_players(title=title)
            return json.dumps(players, indent=2)
        except Exception as e:
            logger.error("Error retrieving titled players", title=title, error=str(e))
            return f"Error retrieving titled players: {str(e)}"
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It only states that the tool retrieves a list but provides no details on behavior such as read-only nature, response structure, potential errors, or rate limits. The description is insufficient for an agent to understand the tool's side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While the description is short (one sentence), it omits critical information that would justify its brevity. Conciseness should not come at the cost of completeness; here, the agent is left guessing about parameter values and usage context.

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 that there is an output schema, the description could omit return details, but it still fails to explain the meaning of 'titled players', valid title values, or the default behavior of the tool. The minimum viable information required for correct invocation is missing.

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?

The input schema has schema description coverage of 0%, and the tool description does not explain the 'title' parameter's valid values (e.g., 'GM', 'IM', 'FM', etc.) or its format. The agent has no information to correctly construct the parameter value beyond the schema's type constraint.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'list of titled players from Chess.com', distinguishing it from sibling tools that focus on individual player data or game downloads. However, it does not explain what 'titled players' means, which could be ambiguous for the agent.

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 guidance is provided on when to use this tool versus alternatives like download_player_games_pgn or get_player_profile. There is no mention of prerequisites, context, or conditions that would inform appropriate invocation.

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/pab1it0/chess-mcp'

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