Skip to main content
Glama
stevenyuser

NBA MCP Server

by stevenyuser

get_live_game_boxscore

Retrieve live NBA game statistics including scores, player performance data, and game events using a specific game identifier.

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
NameRequiredDescriptionDefault
game_idYes

Implementation Reference

  • The main handler function decorated with @mcp.tool, which defines and registers the get_live_game_boxscore tool. It fetches live boxscore data using nba_api.
    @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 tool with the MCP server.
    @mcp.tool
  • Docstring defining the tool's input schema (game_id: str) and description.
    """ 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. """
  • server.py:4-4 (helper)
    Import of boxscore endpoint used in the handler.
    from nba_api.live.nba.endpoints import scoreboard, boxscore, playbyplay

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/stevenyuser/nba_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server