get_player_game_log
Retrieve detailed game-by-game statistics for NBA players by specifying player ID, season, and season type to analyze performance trends.
Instructions
Get game log for a player by their ID, season, and season type.
Args: player_id: str The id of the player. season: str The season in the format 'YYYY-YY'. season_type: str The type of season. Pattern: "Regular Season", "Pre Season", "Playoffs", "All Star"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"player_id": "<player_id>",
"season": "<season>",
"season_type": "<season_type>"
},
"name": "get_player_game_log"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_id | Yes | ||
| season | Yes | ||
| season_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:42-62 (handler)The @mcp.tool decorated handler function implementing the get_player_game_log tool. It retrieves the game log for a specified player, season, and season type using the nba_api library, with error handling.
@mcp.tool def get_player_game_log(player_id: str, season: str, season_type: str) -> dict: """ Get game log for a player by their ID, season, and season type. Args: player_id: str The id of the player. season: str The season in the format 'YYYY-YY'. season_type: str The type of season. Pattern: "Regular Season", "Pre Season", "Playoffs", "All Star" """ try: log = playergamelog.PlayerGameLog(player_id=player_id, season=season, season_type_all_star=season_type) return log.get_dict() except Exception as e: return {"error": str(e)}