season_pitching_stats
Retrieve comprehensive season-level pitching statistics including ERA, FIP, WHIP, and WAR from FanGraphs to analyze performance, compare pitchers, and identify leaders.
Instructions
Get season-level pitching statistics from FanGraphs.
Returns comprehensive stats: ERA, FIP, WHIP, K/9, BB/9, WAR, and many more for every qualifying pitcher.
Args: start_season: First season to include (e.g. 2024). end_season: Last season to include. Omit for a single year. min_innings: Minimum innings pitched to qualify. Leave blank to use the FanGraphs default qualified threshold. player_name: Optional. Filter to one pitcher (e.g. 'Gerrit Cole').
Great for finding pitching leaders, comparing pitchers, or analyzing a season.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_season | Yes | ||
| end_season | No | ||
| min_innings | No | ||
| player_name | No |
Implementation Reference
- src/statcast_mcp/server.py:539-582 (handler)The `season_pitching_stats` function is decorated with `@mcp.tool()` and handles the fetching and formatting of pitching statistics using `pybaseball`.
@mcp.tool() def season_pitching_stats( start_season: int, end_season: int | None = None, min_innings: int | None = None, player_name: str | None = None, ) -> str: """Get season-level pitching statistics from FanGraphs. Returns comprehensive stats: ERA, FIP, WHIP, K/9, BB/9, WAR, and many more for every qualifying pitcher. Args: start_season: First season to include (e.g. 2024). end_season: Last season to include. Omit for a single year. min_innings: Minimum innings pitched to qualify. Leave blank to use the FanGraphs default qualified threshold. player_name: Optional. Filter to one pitcher (e.g. 'Gerrit Cole'). Great for finding pitching leaders, comparing pitchers, or analyzing a season. """ from pybaseball import pitching_stats if end_season is None: end_season = start_season try: data = pitching_stats(start_season, end_season, qual=min_innings) except Exception as e: return f"Error fetching pitching stats: {e}" if player_name: try: data = _filter_player_rows(data, player_name) except ValueError as e: return str(e) if data.empty: return ( f"No FanGraphs pitching row for {player_name} in {start_season}-{end_season} " "with the given IP threshold." ) return _fmt(data, max_rows=50)