Skip to main content
Glama

get_lap_telemetry

Retrieve detailed Formula 1 lap telemetry data including speed, throttle, brake, gear, RPM, and DRS status for specific race sessions and drivers.

Instructions

Get high-frequency telemetry for a lap - speed, throttle, brake, gear, RPM, DRS.

Args: year: Season year (2018+) gp: Grand Prix name or round session: 'FP1', 'FP2', 'FP3', 'Q', 'S', 'R' driver: Driver code or number lap_number: Specific lap number

Returns: LapTelemetryResponse with telemetry points

Example: get_lap_telemetry(2024, "Monza", "R", "VER", 15) → VER lap 15 telemetry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes
gpYes
sessionYes
driverYes
lap_numberYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
driverYesDriver abbreviation
lap_timeNoLap time
telemetryYesTelemetry data points
event_nameYesGrand Prix name
lap_numberYesLap number
session_nameYesSession name
total_pointsYesTotal number of telemetry points

Implementation Reference

  • Core implementation of the get_lap_telemetry tool. Fetches FastF1 session data, loads lap telemetry, processes DataFrame into list of TelemetryPoint models, and returns structured LapTelemetryResponse.
    def get_lap_telemetry(year: int, gp: Union[str, int], session: str, driver: Union[str, int], lap_number: int) -> LapTelemetryResponse:
        """
        Get high-frequency telemetry for a lap - speed, throttle, brake, gear, RPM, DRS.
    
        Args:
            year: Season year (2018+)
            gp: Grand Prix name or round
            session: 'FP1', 'FP2', 'FP3', 'Q', 'S', 'R'
            driver: Driver code or number
            lap_number: Specific lap number
    
        Returns:
            LapTelemetryResponse with telemetry points
    
        Example:
            get_lap_telemetry(2024, "Monza", "R", "VER", 15) → VER lap 15 telemetry
        """
        session_obj = fastf1_client.get_session(year, gp, session)
        session_obj.load(laps=True, telemetry=True, weather=False, messages=False)
    
        event = session_obj.event
    
        driver_laps = session_obj.laps.pick_drivers(driver)
        lap = driver_laps[driver_laps['LapNumber'] == lap_number].iloc[0]
        telemetry_df = lap.get_telemetry()
    
        # Convert to Pydantic models
        telemetry_points = []
        for idx, row in telemetry_df.iterrows():
            point = TelemetryPoint(
                session_time=str(row['SessionTime']) if pd.notna(row.get('SessionTime')) else None,
                distance=float(row['Distance']) if pd.notna(row.get('Distance')) else None,
                speed=float(row['Speed']) if pd.notna(row.get('Speed')) else None,
                rpm=float(row['RPM']) if pd.notna(row.get('RPM')) else None,
                n_gear=int(row['nGear']) if pd.notna(row.get('nGear')) else None,
                throttle=float(row['Throttle']) if pd.notna(row.get('Throttle')) else None,
                brake=float(row['Brake']) if pd.notna(row.get('Brake')) else None,
                drs=int(row['DRS']) if pd.notna(row.get('DRS')) else None,
                x=float(row['X']) if pd.notna(row.get('X')) else None,
                y=float(row['Y']) if pd.notna(row.get('Y')) else None,
                z=float(row['Z']) if pd.notna(row.get('Z')) else None,
            )
            telemetry_points.append(point)
    
        return LapTelemetryResponse(
            session_name=session_obj.name,
            event_name=event['EventName'],
            driver=str(lap['Driver']),
            lap_number=lap_number,
            lap_time=str(lap['LapTime']) if pd.notna(lap.get('LapTime')) else None,
            telemetry=telemetry_points,
            total_points=len(telemetry_points)
        )
  • Pydantic model defining the output schema for get_lap_telemetry response.
    class LapTelemetryResponse(BaseModel):
        """Lap telemetry response."""
    
        session_name: str = Field(description="Session name")
        event_name: str = Field(description="Grand Prix name")
        driver: str = Field(description="Driver abbreviation")
        lap_number: int = Field(description="Lap number")
        lap_time: Optional[str] = Field(None, description="Lap time")
        telemetry: list[TelemetryPoint] = Field(description="Telemetry data points")
        total_points: int = Field(description="Total number of telemetry points")
  • Pydantic model for individual telemetry data points used in lap telemetry response.
    class TelemetryPoint(BaseModel):
        """Single telemetry data point."""
    
        session_time: Optional[str] = Field(None, description="Session time")
        distance: Optional[float] = Field(None, description="Distance in meters")
        speed: Optional[float] = Field(None, description="Speed in km/h")
        rpm: Optional[float] = Field(None, description="Engine RPM")
        n_gear: Optional[int] = Field(None, description="Current gear (1-8)")
        throttle: Optional[float] = Field(None, description="Throttle position (0-100%)")
        brake: Optional[float] = Field(None, description="Brake application (0-100% or boolean)")
        drs: Optional[int] = Field(None, description="DRS status")
        x: Optional[float] = Field(None, description="X position coordinate")
        y: Optional[float] = Field(None, description="Y position coordinate")
        z: Optional[float] = Field(None, description="Z position coordinate")
  • server.py:158-158 (registration)
    MCP tool registration for get_lap_telemetry function.
    mcp.tool()(get_lap_telemetry)
  • Re-export of get_lap_telemetry from tools/telemetry submodule for convenient import in server.py.
    from .telemetry import (
        get_lap_telemetry,
        compare_driver_telemetry,
    )
Behavior2/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. While it states what data is returned, it doesn't describe important behavioral aspects like rate limits, authentication requirements, data freshness, error conditions, or pagination. The description mentions 'high-frequency' telemetry but doesn't quantify what that means. For a data retrieval tool with 5 parameters and no annotations, this is a significant gap.

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 perfectly structured and concise. It begins with a clear purpose statement, provides a well-organized parameter section with bullet-like formatting, includes return information, and ends with a helpful example. Every sentence earns its place, and the information is front-loaded with the most important details first.

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?

Given the tool's complexity (5 parameters, no annotations, but with output schema), the description is mostly complete. The parameter semantics are fully covered, and the existence of an output schema means the description doesn't need to detail return values. However, the lack of behavioral context (rate limits, auth, errors) prevents a perfect score despite the good parameter documentation.

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?

The description provides excellent parameter semantics beyond the 0% schema coverage. It explains each parameter's purpose and format: 'year: Season year (2018+)', 'gp: Grand Prix name or round', 'session: 'FP1', 'FP2', 'FP3', 'Q', 'S', 'R'', 'driver: Driver code or number', 'lap_number: Specific lap number'. This fully compensates for the lack of schema descriptions and provides clear guidance on valid values.

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 clearly states the tool's purpose with specific verb ('Get') and resource ('high-frequency telemetry for a lap'), listing the exact data fields returned (speed, throttle, brake, gear, RPM, DRS). It distinguishes from siblings like 'get_laps' (which likely provides lap times rather than telemetry) and 'compare_driver_telemetry' (which compares rather than retrieves single-lap data).

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?

The description provides clear context about when to use this tool - for retrieving telemetry data for a specific lap. It doesn't explicitly state when NOT to use it or name alternatives, but the specificity of the parameters (year, gp, session, driver, lap_number) implicitly guides usage. No misleading guidance is present.

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/praneethravuri/pitstop'

If you have feedback or need assistance with the MCP directory API, please join our Discord server