download_player_games_pgn
Retrieve PGN files of a player's chess games for a specific month from Chess.com, enabling analysis and review of game history.
Instructions
Download PGN files for all games in a specific month from Chess.com
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| month | Yes | ||
| username | Yes | ||
| year | Yes |
Input Schema (JSON Schema)
{
"properties": {
"month": {
"title": "Month",
"type": "integer"
},
"username": {
"title": "Username",
"type": "string"
},
"year": {
"title": "Year",
"type": "integer"
}
},
"required": [
"username",
"year",
"month"
],
"title": "download_player_games_pgnArguments",
"type": "object"
}
Implementation Reference
- src/chess_mcp/server.py:239-267 (handler)The main handler function for the 'download_player_games_pgn' tool, decorated with @mcp.tool for registration. It formats the month, logs the request, calls make_api_request to fetch PGN data from Chess.com API, and returns the PGN string.@mcp.tool(description="Download PGN files for all games in a specific month from Chess.com") async def download_player_games_pgn( username: str, year: int, month: int ) -> str: """ Download PGN files for all games in a specific month from Chess.com. Args: username: The Chess.com username year: Year (YYYY format) month: Month (MM format, 01-12) Returns: Multi-game PGN format text containing all games for the month """ month_str = str(month).zfill(2) logger.info( "Downloading player games PGN", username=username, year=year, month=month_str ) result = await make_api_request( f"player/{username}/games/{year}/{month_str}/pgn", accept_json=False ) return result