Skip to main content
Glama
stevenyuser

NBA MCP Server

by stevenyuser

get_live_game_play_by_play

Retrieve detailed play-by-play data for NBA games using game IDs to analyze sequences, events, and game flow.

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @mcp.tool that implements the 'get_live_game_play_by_play' tool. It retrieves live play-by-play data for a given NBA game ID using the nba_api library, extracting actions from the game's dictionary, with error handling.
    @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)}]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data, implying a read-only operation, but does not cover aspects like rate limits, authentication needs, error handling, or data freshness (e.g., real-time vs. cached). For a tool with no annotations, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded. The first sentence clearly states the purpose, and the 'Args' section efficiently documents the parameter without unnecessary details. Every sentence adds value, making it concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter) and the presence of an output schema, the description is reasonably complete. It covers the basic purpose and parameter, and the output schema likely handles return values. However, without annotations and with minimal behavioral details, it could be more comprehensive for a data-fetching tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal meaning beyond the input schema. It defines 'game_id' as 'The ID of the game,' which is basic and does not elaborate on format, sourcing, or validation. With 0% schema description coverage, the description compensates slightly by naming the parameter, but does not fully address the coverage gap, resulting in adequate but incomplete parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the play-by-play data for a specific game by its ID.' It specifies the verb ('Get'), resource ('play-by-play data'), and scope ('for a specific game'), but does not explicitly differentiate it from sibling tools like 'get_live_game_boxscore', which likely provides different game data. This makes it clear but not fully sibling-distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions the tool fetches play-by-play data, but does not indicate scenarios where this is preferred over other game-related tools (e.g., 'get_live_game_boxscore' for summary stats or 'get_today_scoreboard' for scores). This lack of comparative context leaves usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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