Skip to main content
Glama
alex-rimerman

Statcast MCP Server

statcast_batter_expected_stats

Calculate expected batting statistics (xBA, xSLG, xwOBA) to identify hitters whose performance aligns with or deviates from their quality of contact.

Instructions

Get expected batting stats (xBA, xSLG, xwOBA vs actual) from Statcast.

Returns xBA, xSLG, xwOBA and the gap from actual stats — what a batter deserves based on quality of contact.

Args: year: Season year (e.g. 2024). min_plate_appearances: Minimum PA to qualify (default 50). player_name: Optional. If set (e.g. 'Aaron Judge'), returns only that player's row — use this so a star is not cut off by the 50-row leaderboard limit.

Great for identifying lucky/unlucky hitters or a single player's expected line.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes
min_plate_appearancesNo
player_nameNo

Implementation Reference

  • The handler function 'statcast_batter_expected_stats' which retrieves expected batting statistics by delegating to the 'pybaseball' library.
    def statcast_batter_expected_stats(
        year: int,
        min_plate_appearances: int = 50,
        player_name: str | None = None,
    ) -> str:
        """Get expected batting stats (xBA, xSLG, xwOBA vs actual) from Statcast.
    
        Returns xBA, xSLG, xwOBA and the gap from actual stats — what a batter
        *deserves* based on quality of contact.
    
        Args:
            year: Season year (e.g. 2024).
            min_plate_appearances: Minimum PA to qualify (default 50).
            player_name: Optional. If set (e.g. 'Aaron Judge'), returns only that
                player's row — use this so a star is not cut off by the 50-row
                leaderboard limit.
    
        Great for identifying lucky/unlucky hitters or a single player's expected line.
        """
        from pybaseball import statcast_batter_expected_stats as _fn
    
        try:
            data = _fn(year, minPA=min_plate_appearances)
        except Exception as e:
            return f"Error fetching expected batting stats: {e}"
    
        if player_name:
            try:
                data = _filter_player_rows(data, player_name)
            except ValueError as e:

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