Skip to main content
Glama
alex-rimerman

Statcast MCP Server

pitcher_percentile_ranks

Compare pitcher performance metrics like spin rate, whiff percentage, and xERA against league averages using percentile rankings from 0-100.

Instructions

Statcast percentile ranks for pitchers vs the league (spin, whiff%, xERA, etc.).

Each metric is 0–100. Use for "How does this pitcher's stuff compare?"

Args: year: Season year (e.g. 2024). player_name: Optional. Filter to one pitcher (e.g. "Gerrit Cole").

Qualifying pitchers: Statcast minimum innings/appearance thresholds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes
player_nameNo

Implementation Reference

  • The pitcher_percentile_ranks MCP tool handler, which utilizes pybaseball to fetch and optionally filter statcast percentile data.
    @mcp.tool()
    def pitcher_percentile_ranks(year: int, player_name: str | None = None) -> str:
        """Statcast percentile ranks for pitchers vs the league (spin, whiff%, xERA, etc.).
    
        Each metric is 0–100. Use for "How does this pitcher's stuff compare?"
    
        Args:
            year: Season year (e.g. 2024).
            player_name: Optional. Filter to one pitcher (e.g. "Gerrit Cole").
    
        Qualifying pitchers: Statcast minimum innings/appearance thresholds.
        """
        from pybaseball import statcast_pitcher_percentile_ranks as _fn
    
        try:
            data = _fn(year)
        except Exception as e:
            return f"Error fetching pitcher percentile ranks: {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 percentile data found for {player_name} in {year}."
    
        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