Skip to main content
Glama
alex-rimerman

Statcast MCP Server

season_batting_stats

Retrieve comprehensive season batting statistics from FanGraphs to analyze player performance, compare batters, and identify league leaders across multiple metrics.

Instructions

Get season-level batting statistics from FanGraphs.

Returns comprehensive stats: AVG, OBP, SLG, wOBA, wRC+, HR, SB, WAR, and many more for every qualifying batter.

Args: start_season: First season to include (e.g. 2024). end_season: Last season to include. Omit for a single year. min_plate_appearances: Minimum plate appearances to qualify. Leave blank to use the FanGraphs default qualified threshold. player_name: Optional. Filter to one player (e.g. 'Aaron Judge').

Great for finding league leaders, comparing players, or reviewing a full season.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_seasonYes
end_seasonNo
min_plate_appearancesNo
player_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that executes the `season_batting_stats` tool logic, fetching and formatting batting statistics.
    def season_batting_stats(
        start_season: int,
        end_season: int | None = None,
        min_plate_appearances: int | None = None,
        player_name: str | None = None,
    ) -> str:
        """Get season-level batting statistics from FanGraphs.
    
        Returns comprehensive stats: AVG, OBP, SLG, wOBA, wRC+, HR, SB, WAR,
        and many more for every qualifying batter.
    
        Args:
            start_season: First season to include (e.g. 2024).
            end_season: Last season to include. Omit for a single year.
            min_plate_appearances: Minimum plate appearances to qualify.
                Leave blank to use the FanGraphs default qualified threshold.
            player_name: Optional. Filter to one player (e.g. 'Aaron Judge').
    
        Great for finding league leaders, comparing players, or reviewing a full season.
        """
        from pybaseball import batting_stats
    
        if end_season is None:
            end_season = start_season
    
        try:
            data = batting_stats(start_season, end_season, qual=min_plate_appearances)
        except Exception as e:
            return f"Error fetching batting 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 batting row for {player_name} in {start_season}-{end_season} "
                    "with the given PA threshold."
                )
    
        return _fmt(data, max_rows=50)
  • The decorator used to register the `season_batting_stats` function as an MCP tool.
    @mcp.tool()
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Adds valuable context about FanGraphs data source, 'qualifying batter' logic, and comprehensive stat types (AVG, wOBA, WAR, etc.). However, misses error handling, rate limits, data volume expectations, and response structure details.

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?

Well-structured with purpose front-loaded, followed by return value description, Args documentation, and use cases. Slightly verbose but necessary given schema coverage gaps. The 'Args:' section is efficiently formatted with inline examples.

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

Completeness4/5

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

Appropriate for complexity: has output schema (covering return details) and 4 well-documented parameters. Lacks only advanced context like data freshness, pagination for large multi-season queries, or error scenarios that would merit a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by documenting all 4 parameters in the Args section: start_season (with example 2024), end_season (omit for single year), min_plate_appearances (blank for default), and player_name (optional filter with example).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb ('Get') + resource ('season-level batting statistics') + source ('FanGraphs'). Explicitly distinguishes from siblings: contrasts with 'batting_stats_date_range' (season-level vs date range), 'season_pitching_stats' (batting vs pitching), and 'team_season_batting_stats' (individual qualifying batters vs team).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides implied usage context ('Great for finding league leaders, comparing players, or reviewing a full season') but lacks explicit when-to-use guidance versus alternatives like 'batting_stats_date_range' or 'statcast_batter'. No exclusions or prerequisites mentioned.

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

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