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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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)
    
    
    # ---------------------------------------------------------------------------
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 behavioral context about 'Qualifying pitchers' requiring Statcast minimum thresholds and the 0-100 scale. Missing operational details like rate limits, caching behavior, or empty result handling.

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?

Efficient structure with no wasted words. Front-loads the core definition, follows with use case, then parameter details. The 'Args:' docstring style is slightly informal but functional. Every sentence provides unique value not found in structured fields.

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?

Adequate for a 2-parameter lookup tool with existing output schema. Covers domain-specific qualifying thresholds crucial for baseball statistics. Does not need to describe return values since output schema exists, and parameter documentation is complete despite poor schema coverage.

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

Parameters4/5

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

Schema has 0% description coverage. Description fully compensates by documenting both parameters with clear semantics and examples ('2024', 'Gerrit Cole') and noting player_name is optional. Effectively substitutes for missing schema descriptions.

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

Purpose4/5

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

Clear verb-resource combination ('percentile ranks for pitchers') with specific examples (spin, whiff%, xERA) and scale (0-100). Distinguishes from batter-focused sibling via 'pitchers' and 'Statcast' context, though could explicitly contrast with raw stat siblings like statcast_pitcher.

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 explicit use case ('Use for How does this pitcher's stuff compare?') and qualifying thresholds note. However, lacks explicit when-not-to-use guidance or differentiation from similar pitching stat tools (season_pitching_stats, statcast_pitcher_expected_stats).

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