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

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

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