Skip to main content
Glama
alex-rimerman

Statcast MCP Server

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

TableJSON Schema
NameRequiredDescriptionDefault
start_seasonYes
end_seasonNo
min_inningsNo
player_nameNo

Implementation Reference

  • 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)

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/alex-rimerman/statcast-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server