get_player_career_stats
Retrieve comprehensive career statistics for NBA players by entering their unique player ID to access detailed performance data.
Instructions
Get career stats for a player by their ID.
Args: player_id: str The id of the player.
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>"
},
"name": "get_player_career_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:12-25 (handler)The handler function for the 'get_player_career_stats' tool. It is decorated with @mcp.tool, which registers it as an MCP tool. The function retrieves NBA player career statistics using the nba_api library based on the provided player_id.
@mcp.tool def get_player_career_stats(player_id: str) -> dict: """ Get career stats for a player by their ID. Args: player_id: str The id of the player. """ try: stats = playercareerstats.PlayerCareerStats(player_id=player_id) return stats.get_dict() except Exception as e: return {"error": str(e)}