statcast_pitcher
Retrieve detailed pitch-level data for MLB pitchers, including pitch types, velocity, spin rates, movement metrics, and exit velocity allowed, to analyze performance trends over specified date ranges.
Instructions
Get pitch-level Statcast data for a specific pitcher in a date range.
Returns every pitch thrown — pitch type, velocity, spin rate, movement, exit velocity allowed, and more.
Args: player_name: Full name of the pitcher (e.g. 'Gerrit Cole'). 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 pitcher's stuff, outings, or trends over time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_name | Yes | ||
| start_date | Yes | ||
| end_date | No |
Implementation Reference
- src/statcast_mcp/server.py:449-492 (handler)The statcast_pitcher tool handler, decorated with @mcp.tool(), which fetches pitch-level data for a specific pitcher.
@mcp.tool() def statcast_pitcher( player_name: str, start_date: str, end_date: str | None = None, ) -> str: """Get pitch-level Statcast data for a specific pitcher in a date range. Returns every pitch thrown — pitch type, velocity, spin rate, movement, exit velocity allowed, and more. Args: player_name: Full name of the pitcher (e.g. 'Gerrit Cole'). 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 pitcher's stuff, outings, or trends over time. """ from pybaseball import statcast_pitcher as _sp 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 = _sp(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 pitching data for {name} (MLBAM ID: {mlbam_id}):\n\n" + _fmt(data, max_rows=100) ) # --------------------------------------------------------------------------- # Tools — Season-Level Stats (FanGraphs) # ---------------------------------------------------------------------------