get_titled_players
Retrieve a list of titled chess players from Chess.com based on a specified title, enabling analysis or interaction with top-tier competitors.
Instructions
Get a list of titled players from Chess.com
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes |
Input Schema (JSON Schema)
{
"properties": {
"title": {
"title": "Title",
"type": "string"
}
},
"required": [
"title"
],
"title": "get_titled_playersArguments",
"type": "object"
}
Implementation Reference
- src/chess_mcp/server.py:185-207 (handler)The main handler function for the 'get_titled_players' tool. It is decorated with @mcp.tool, which registers it and defines the schema via type hints and description. Validates the input title against a list of valid chess titles and fetches the list of titled players from the Chess.com API using make_api_request.@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}")