get_live_game_boxscore
Retrieve live game box scores, including player stats, scores, and timeouts, by specifying the game ID using the NBA MCP Server. Access detailed NBA game data efficiently.
Instructions
Get the box score for a specific game by its ID. The box score includes live data for the game, such as scores, player stats, timeouts, and more.
Args: game_id: str The ID of the game.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| game_id | Yes |
Implementation Reference
- server.py:154-170 (handler)The main handler function for the 'get_live_game_boxscore' tool, decorated with @mcp.tool which registers it in the FastMCP server. It retrieves the live boxscore for a given game ID using the nba_api library.@mcp.tool def get_live_game_boxscore(game_id: str) -> dict: """ Get the box score for a specific game by its ID. The box score includes live data for the game, such as scores, player stats, timeouts, and more. Args: game_id: str The ID of the game. """ try: box = boxscore.BoxScore(game_id) if not box.game or not box.game.get_dict(): raise ValueError(f"No box score found for game ID: {game_id}") return box.game.get_dict() except Exception as e: return {"error": str(e)}
- server.py:154-154 (registration)The @mcp.tool decorator registers the get_live_game_boxscore function as an MCP tool.@mcp.tool
- server.py:156-163 (schema)The docstring defines the tool schema, including input parameter 'game_id: str'.""" Get the box score for a specific game by its ID. The box score includes live data for the game, such as scores, player stats, timeouts, and more. Args: game_id: str The ID of the game. """