get_lap_times
Get all lap times for a Formula 1 driver in a session, with summary statistics and optional CSV export for data analysis.
Instructions
Get all lap times for a driver in a session.
Data source: FastF1 Live Timing Coverage: 2018-present
Set export_path=True when the user mentions data analysis, notebooks,
pandas, ML, "save as CSV", "export the data", or any downstream
processing — the full per-lap array is then written to a CSV file the
user can open directly. Large responses (>50 laps) also auto-export so
the user always gets a real file path in the project rather than the
MCP client silently spilling the response to a temp file.
Args:
year: Season year (2018+)
event: Race name or round number
session: Session type (R, Q, S, FP1, FP2, FP3)
driver: Driver code (e.g., "VER") or number (e.g., "1")
include_deleted: Include deleted lap times (default False)
export_path: If True, write the full per-lap array to a CSV in the
configured export directory (default ./fastf1-exports/,
override via FASTF1_MCP_EXPORT_DIR) and omit laps from
the response. Pass a string for a custom directory or
.csv file path. The server also auto-exports when
the lap count exceeds FASTF1_MCP_AUTO_EXPORT_ROWS
(default 50).
Returns: Default (no export): { "driver": "VER", "fullName": "Max Verstappen", "teamName": "Red Bull Racing", "summary": {...}, "laps": [{"lapNumber": 1, "lapTime": "0:01:30.456", ...}, ...] }
With export_path:
{
"driver": "VER", "fullName": ..., "teamName": ...,
"summary": {...},
"exportPath": "/abs/path/to/get_lap_times_2024_monaco_r_ver_<ts>.csv",
"rowCount": 52
}Note:
Deleted laps (e.g., track limits violations) are excluded by default.
Set include_deleted=True to include them.
summary lets a caller answer fastest/avg/compound questions without
re-parsing the full per-lap array. Use export_path=True to grab the
full dataset as CSV for downstream analysis / ML work.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | ||
| event | Yes | ||
| session | Yes | ||
| driver | Yes | ||
| include_deleted | No | ||
| export_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||