team_standings
Retrieve MLB division standings for any season to view win-loss records, winning percentages, and games back for all 30 teams organized by division.
Instructions
Get MLB division standings for a given season.
Returns win-loss records, winning percentage, and games back for all 30 teams organised by division (AL East, AL Central, AL West, NL East, NL Central, NL West).
Args: season: The season year (e.g. 2024).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| season | Yes |
Implementation Reference
- src/statcast_mcp/server.py:1147-1175 (handler)The handler implementation for the 'team_standings' MCP tool, which fetches standings using pybaseball.
@mcp.tool() def team_standings(season: int) -> str: """Get MLB division standings for a given season. Returns win-loss records, winning percentage, and games back for all 30 teams organised by division (AL East, AL Central, AL West, NL East, NL Central, NL West). Args: season: The season year (e.g. 2024). """ from pybaseball import standings try: tables = standings(season) except Exception as e: return f"Error fetching standings: {e}" if not tables: return "No standings data found." division_names = [ "AL East", "AL Central", "AL West", "NL East", "NL Central", "NL West", ]