Skip to main content
Glama
stevenyuser

NBA MCP Server

by stevenyuser

get_team_year_by_year_stats

Retrieve historical performance data for NBA teams by entering their ID to analyze trends and statistics across multiple seasons.

Instructions

Get year-by-year stats for a team by their ID.

Args: team_id: str The id of the team.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.py:82-96 (handler)
    The handler function decorated with @mcp.tool, which registers and implements the get_team_year_by_year_stats tool. It retrieves year-by-year stats for a given team ID using the nba_api library.
    @mcp.tool
    def get_team_year_by_year_stats(team_id: str) -> dict:
        """
        Get year-by-year stats for a team by their ID.
    
        Args:
          team_id: str
            The id of the team.
        """
        try:
            stats = teamyearbyyearstats.TeamYearByYearStats(team_id=team_id)
            return stats.get_dict()
        except Exception as e:
            return {"error": str(e)}
  • server.py:82-82 (registration)
    The @mcp.tool decorator registers the function as an MCP tool.
    @mcp.tool
  • Input schema defined by type hints (team_id: str) and output (dict), with docstring describing args.
    def get_team_year_by_year_stats(team_id: str) -> dict:
        """
        Get year-by-year stats for a team by their ID.
    
        Args:
          team_id: str
            The id of the team.
        """
  • server.py:3-3 (helper)
    Import of teamyearbyyearstats endpoint used by the tool.
    from nba_api.stats.endpoints import playercareerstats, playerawards, playergamelog, teamyearbyyearstats, teamdetails, teamgamelog, leaguestandingsv3
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 only states what the tool does without mentioning traits like read-only vs. destructive, authentication needs, rate limits, or error handling. For a data retrieval tool, this leaves gaps in understanding operational constraints and response behavior.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the main purpose is stated first, followed by a brief parameter explanation. It avoids unnecessary details, but the structure could be improved by integrating the parameter info more seamlessly rather than as a separate 'Args' section.

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

Completeness3/5

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

Given the tool's complexity (simple retrieval with 1 parameter) and the presence of an output schema, the description is somewhat complete but lacks depth. It covers the basic action and parameter, but without annotations or details on usage context, it falls short of being fully helpful for an agent navigating among multiple team-related tools.

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 semantics beyond the input schema: it explains 'team_id' as 'The id of the team,' which is basic but clarifies the parameter's purpose. With 0% schema description coverage and 1 parameter, this compensates slightly, but it doesn't provide format details or examples, keeping it at a baseline level.

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 year-by-year stats for a team by their ID.' It specifies the verb ('Get') and resource ('year-by-year stats for a team'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_team_details' or 'get_team_game_log,' which might also involve team data, so it misses full sibling distinction.

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 doesn't mention scenarios like comparing team performance over time or prerequisites such as needing a valid team ID. With siblings like 'get_team_game_log' for game-level data, the lack of context leaves the agent guessing about appropriate use cases.

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