Skip to main content
Glama
alex-rimerman

Statcast MCP Server

batting_stats_date_range

Analyze baseball batting statistics for any custom date range to identify performance trends, hot streaks, or specific time periods. Filter by player to examine individual performance during selected windows.

Instructions

Batting stats aggregated over a custom date range (Baseball Reference).

Use for hot/cold streaks, post-deadline samples, or any window between two dates.

Args: start_date: Start date YYYY-MM-DD (2008+). end_date: End date YYYY-MM-DD (inclusive). player_name: Optional. Filter to one player (matches BRef Name / mlbID).

Returns rate stats (AVG, OBP, SLG, OPS) and counting stats for that span. Row limit applies — many players may qualify in long ranges.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateYes
player_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the `batting_stats_date_range` MCP tool. It uses `pybaseball.batting_stats_range` to fetch data for the given date range and filters the results if a player name is provided.
    def batting_stats_date_range(
        start_date: str,
        end_date: str,
        player_name: str | None = None,
    ) -> str:
        """Batting stats aggregated over a custom date range (Baseball Reference).
    
        Use for hot/cold streaks, post-deadline samples, or any window between two dates.
    
        Args:
            start_date: Start date YYYY-MM-DD (2008+).
            end_date: End date YYYY-MM-DD (inclusive).
            player_name: Optional. Filter to one player (matches BRef ``Name`` / ``mlbID``).
    
        Returns rate stats (AVG, OBP, SLG, OPS) and counting stats for that span.
        Row limit applies — many players may qualify in long ranges.
        """
        from pybaseball import batting_stats_range as _fn
    
        try:
            data = _fn(start_date, end_date)
        except Exception as e:
            return f"Error fetching batting stats for date range: {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 batting stats for {player_name} in {start_date}–{end_date}."
    
        return _fmt(data, max_rows=50)
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 by disclosing the Baseball Reference data source, date constraints (2008+), row limit warnings, and specific return value types (AVG, OBP, SLG, OPS plus counting stats). Could mention rate limiting or null 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?

Well-structured with clear sections for purpose, usage, arguments, and returns. The Args block is necessary given the empty schema, though the format is slightly verbose. Every sentence adds value, including the critical row limit warning.

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?

Comprehensive for a date-range aggregation tool: covers input constraints, output schema summary (rate and counting stats), and data source. Since an output schema exists, the brief return description is appropriate, though timezone handling for dates could be mentioned.

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?

Given 0% schema description coverage, the description fully compensates by documenting all three parameters with precise semantics: date formats (YYYY-MM-DD), constraints (2008+, inclusive), and player_name matching behavior (BRef Name/mlbID) including optionality.

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?

Description clearly states the tool aggregates batting statistics over a custom date range from Baseball Reference, using specific verbs ('aggregated') and distinguishing itself from sibling season stats and Statcast tools through the date range scope.

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

Usage Guidelines4/5

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

Provides explicit usage scenarios ('hot/cold streaks, post-deadline samples, or any window between two dates') that clearly indicate when to use this over season-long tools, though it doesn't explicitly name sibling alternatives like season_batting_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