Skip to main content
Glama
alex-rimerman

Statcast MCP Server

statcast_batter

Retrieve detailed pitch-level data for MLB batters, including pitch types, velocities, exit velocities, launch angles, and expected batting averages within specified date ranges.

Instructions

Get pitch-level Statcast data for a specific batter in a date range.

Returns every pitch the batter saw — pitch type, velocity, exit velocity, launch angle, expected batting average, and much more.

Args: player_name: Full name of the batter (e.g. 'Aaron Judge'). start_date: Start date in YYYY-MM-DD format. end_date: End date in YYYY-MM-DD format (defaults to start_date).

Great for analyzing a hitter's performance over a specific period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
player_nameYes
start_dateYes
end_dateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool 'statcast_batter' is defined and implemented here using the @mcp.tool() decorator. It handles player resolution and fetches data using the pybaseball library.
    @mcp.tool()
    def statcast_batter(
        player_name: str,
        start_date: str,
        end_date: str | None = None,
    ) -> str:
        """Get pitch-level Statcast data for a specific batter in a date range.
    
        Returns every pitch the batter saw — pitch type, velocity, exit velocity,
        launch angle, expected batting average, and much more.
    
        Args:
            player_name: Full name of the batter (e.g. 'Aaron Judge').
            start_date: Start date in YYYY-MM-DD format.
            end_date: End date in YYYY-MM-DD format (defaults to start_date).
    
        Great for analyzing a hitter's performance over a specific period.
        """
        from pybaseball import statcast_batter as _sb
    
        try:
            mlbam_id, name = _resolve_player(player_name)
        except ValueError as e:
            return str(e)
    
        if end_date is None:
            end_date = start_date
    
        try:
            data = _sb(start_dt=start_date, end_dt=end_date, player_id=mlbam_id)
        except Exception as e:
            return f"Error fetching data for {player_name}: {e}"
    
        data = _trim_pitch_cols(data)
        return (
            f"Statcast batting data for {name} (MLBAM ID: {mlbam_id}):\n\n"
            + _fmt(data, max_rows=100)
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively details the return payload ('every pitch the batter saw — pitch type, velocity, exit velocity...'), explaining the granularity and richness of data returned. It also clarifies the date range behavior (end_date defaults to start_date). Minor gap: doesn't explicitly state this is a safe read operation, though 'Get' implies this.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded: purpose statement first, return value details second, parameter specifications third, and use case last. Every sentence earns its place; there is no redundant or wasted text. The Args block efficiently handles parameter documentation.

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

Completeness5/5

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

Given that an output schema exists (so full return value specification isn't required in text), the description provides an excellent preview of returned fields. It covers all parameters (compensating for the schema's lack of descriptions), explains the date logic, and provides the usage context. Complete for a query tool of this complexity.

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 providing an 'Args' section that documents all three parameters with clear semantics: player_name includes a concrete example ('Aaron Judge'), and both date fields specify the exact format ('YYYY-MM-DD') and default behavior. This adds essential meaning missing from the structured schema.

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?

The description opens with a precise action ('Get pitch-level Statcast data'), identifies the specific resource (pitch-level data), and scopes it to 'a specific batter in a date range.' This clearly distinguishes it from sibling aggregation tools like 'batting_stats_date_range' (which likely returns summary stats) and 'statcast_pitcher' (which covers pitchers).

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?

The description includes the line 'Great for analyzing a hitter's performance over a specific period,' which implies the use case. However, it lacks explicit guidance on when to prefer this over siblings like 'statcast_batter_expected_stats' or 'statcast_batter_exitvelo_barrels' for specific analyses, or when to use the broader 'statcast_search' instead.

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