Skip to main content
Glama
stevenyuser

NBA MCP Server

by stevenyuser

get_live_game_play_by_play

Retrieve play-by-play data for a specific NBA game by providing its unique game ID. Access detailed information about each play, including sequences and events, for analysis or integration.

Instructions

Get the play-by-play data for a specific game by its ID. The play-by-play data includes detailed information about each play in the game.

Args: game_id: str The ID of the game.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
game_idYes

Implementation Reference

  • The handler function for the 'get_live_game_play_by_play' tool, registered via @mcp.tool decorator. It fetches play-by-play data using playbyplay.PlayByPlay(game_id), extracts actions from the dict, and handles errors.
    @mcp.tool def get_live_game_play_by_play(game_id: str) -> list: """ Get the play-by-play data for a specific game by its ID. The play-by-play data includes detailed information about each play in the game. Args: game_id: str The ID of the game. """ try: pbp = playbyplay.PlayByPlay(game_id) plays = pbp.get_dict()['game']['actions'] # plays = actions if not plays: raise ValueError(f"No play-by-play data found for game ID: {game_id}") return plays except Exception as e: return [{"error": str(e)}]

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