Skip to main content
Glama
fastf1-mcp-server

fastf1-mcp-server

by Surya96t

get_position_changes

Retrieve lap-by-lap positions and gaps to leader to see how an F1 race unfolded, who gained places, and when leads changed.

Instructions

Get how a race unfolded: lap-by-lap positions, gaps to the leader, positions gained from the grid, laps led and lead changes.

Data source: FastF1 Live Timing Coverage: 2018-present

Use for "how did the race unfold", "who gained the most places", "when did X take the lead", "how far behind was Y at half distance", or "how many places did Z make up on lap 1".

Args: year: Season year (2018+) event: Race name or round number session: "R" (race, default) or "S" (sprint) drivers: Optional driver codes to include (e.g. ["VER", "NOR"]). The session-wide summary always covers the full field. include_laps: Include the per-lap positions and gapsToLeaderSec arrays for each driver (default True). Set False for a compact grid→finish movement table. export_path: If True (or a directory / .csv path), write a long format CSV (one row per driver per lap: lap, driver, position, gapToLeaderSec) and omit the per-lap arrays.

Returns: { "totalLaps": 57, "summary": { "winner": "VER", "lapLeaders": {"VER": 50, "LEC": 7}, "leadChanges": [{"lap": 21, "from": "VER", "to": "LEC"}, ...], "biggestGainers": [{"driver": "HAM", "grid": 18, "finish": 6, "positionsGained": 12}, ...], "biggestLosers": [...] }, "drivers": [ {"driver": "VER", "fullName": "Max Verstappen", "teamName": "Red Bull Racing", "grid": 1, "finish": 1, "status": "Finished", "positionsGained": 0, "lap1Gain": 0, "lapsLed": 50, "bestPosition": 1, "worstPosition": 2, "positions": [1, 1, 1, ...], "gapsToLeaderSec": [0.0, 0.0, ...]}, ... ] }

Note: positions[i] / gapsToLeaderSec[i] are for lap i+1. The gap is the time between the leader completing that lap and this driver completing the same lap (the classic "race history" gap, so lapped cars show their full deficit). Pit-lane starters have grid 0 in the source data; their gain is computed from the back of the grid.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "year": "<year>",
      "event": "<event>"
    },
    "name": "get_position_changes"
  }
}

Input Schema

NameRequiredDescriptionDefault
yearYes
eventYes
driversNo
sessionNoR
export_pathNo
include_lapsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the data source (FastF1 Live Timing), coverage window (2018-present), and the file-writing side effect of export_path, which is the main destructive-ish behavior. It omits things like where the file is written, permissions needed, and behavior when data is unavailable.

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 and front-loaded: purpose, source, coverage, use cases, args, returns, then a semantics note. The Returns block largely restates an output schema that already exists, and the trailing note on index offsets is dense, but nothing is genuinely wasted.

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?

For a six-parameter analytical tool with no annotations, the definition covers the source, coverage, defaults, the export side effect, array indexing semantics, and the pit-lane-starter edge case (grid 0). An agent has everything needed to call it and interpret the result correctly.

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?

Schema coverage is 0%, yet every one of the six parameters is explained in the description with meaning beyond the schema: event accepts a name or round number, session is 'R' or 'S', drivers takes codes while summary always covers the full field, and include_laps/export_path interact. This fully compensates for the empty 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?

The opening sentence names a specific verb and a well-defined resource: lap-by-lap positions, gaps to leader, positions gained, laps led and lead changes for a race. It is clearly not a lap-times or telemetry tool, though it never names a sibling such as get_lap_times or plot_position_chart to make the boundary explicit.

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?

Four quoted user phrasings map intent to this tool, and the args section gives conditional guidance ('Set False for a compact grid→finish movement table', 'If True ... write a long format CSV'). It lacks an explicit when-not statement or a named alternative for the overlapping cases (lap times, session results).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.