Skip to main content
Glama
notsedano

Formula One MCP Server

get_telemetry

Retrieve detailed telemetry data for specific Formula One laps to analyze driver performance and vehicle metrics during races or sessions.

Instructions

Get telemetry data for a specific Formula One lap

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesSeason year (e.g., 2023)
event_identifierYesEvent name or round number (e.g., 'Monaco' or '7')
session_nameYesSession name (e.g., 'Race', 'Qualifying', 'Sprint', 'FP1', 'FP2', 'FP3')
driver_identifierYesDriver identifier (number, code, or name; e.g., '44', 'HAM', 'Hamilton')
lap_numberNoLap number (optional, gets fastest lap if not provided)

Implementation Reference

  • The core handler function that implements the get_telemetry tool logic using FastF1 library to fetch session data, select lap, extract telemetry, and serialize to JSON.
    def get_telemetry(
        year, event_identifier, session_name, driver_identifier, lap_number=None
    ):
        """
        Get telemetry data for a specific lap or fastest lap.
    
        Args:
            year (int or str): The year of the F1 season
            event_identifier (str): Event name or round number
            session_name (str): Session type (Race, Qualifying, Sprint, etc.)
            driver_identifier (str): Driver number, code, or name
            lap_number (int, optional): Specific lap number or None for fastest lap
    
        Returns:
            dict: Status and telemetry data or error information
        """
        try:
            year = int(year)
            session = fastf1.get_session(year, event_identifier, session_name)
            session.load()
    
            # Get laps for the specified driver
            driver_laps = session.laps.pick_driver(driver_identifier)
    
            if len(driver_laps) == 0:
                return {
                    "status": "error",
                    "message": f"No laps found for driver {driver_identifier}",
                }
    
            # Get the specific lap or fastest lap
            if lap_number:
                matching_laps = driver_laps[driver_laps["LapNumber"] == int(lap_number)]
                if len(matching_laps) == 0:
                    return {
                        "status": "error",
                        "message": (
                            f"Lap number {lap_number} not found for driver "
                            f"{driver_identifier}"
                        ),
                    }
                lap = matching_laps.iloc[0]
            else:
                lap = driver_laps.pick_fastest()
                if lap is None:
                    return {
                        "status": "error",
                        "message": "No valid fastest lap found for driver "
                        f"{driver_identifier}",
                    }
    
            # Get telemetry data
            telemetry = lap.get_telemetry()
    
            # Convert to JSON serializable format
            telemetry_dict = telemetry.to_dict(orient="records")
            clean_data = []
    
            for item in telemetry_dict:
                clean_item = {k: json_serial(v) for k, v in item.items()}
                clean_data.append(clean_item)
    
            # Add lap information
            lap_info = {
                "LapNumber": int(lap["LapNumber"])
                if not pd.isna(lap["LapNumber"])
                else None,
                "LapTime": str(lap["LapTime"]) if not pd.isna(lap["LapTime"]) else None,
                "Compound": lap["Compound"] if not pd.isna(lap["Compound"]) else None,
                "TyreLife": int(lap["TyreLife"]) if not pd.isna(lap["TyreLife"]) else None,
            }
    
            result = {"lapInfo": lap_info, "telemetry": clean_data}
    
            return {"status": "success", "data": result}
        except Exception as e:
            return {"status": "error", "message": str(e)}
  • MCP tool registration in list_tools(), including name, description, and detailed input schema definition for the get_telemetry tool.
    types.Tool(
        name="get_telemetry",
        description=("Get telemetry data for a specific Formula One lap"),
        inputSchema={
            "type": "object",
            "properties": {
                "year": {
                    "type": "number",
                    "description": "Season year (e.g., 2023)",
                },
                "event_identifier": {
                    "type": "string",
                    "description": (
                        "Event name or round number (e.g., 'Monaco' or '7')"
                    ),
                },
                "session_name": {
                    "type": "string",
                    "description": (
                        "Session name (e.g., 'Race', 'Qualifying', "
                        "'Sprint', 'FP1', 'FP2', 'FP3')"
                    ),
                },
                "driver_identifier": {
                    "type": "string",
                    "description": (
                        "Driver identifier (number, code, or name; "
                        "e.g., '44', 'HAM', 'Hamilton')"
                    ),
                },
                "lap_number": {
                    "type": "number",
                    "description": (
                        "Lap number (optional, gets fastest lap if not "
                        "provided)"
                    ),
                },
            },
            "required": [
                "year",
                "event_identifier",
                "session_name",
                "driver_identifier",
            ],
        },
    ),
    types.Tool(
  • Dispatch logic in the main @app.call_tool() handler that validates inputs and invokes the get_telemetry function.
    elif name == "get_telemetry":
        lap_number = arguments.get("lap_number")
        if lap_number is not None:
            try:
                lap_number = int(lap_number)
                if lap_number <= 0:
                    raise ValueError("Lap number must be positive")
            except (ValueError, TypeError) as e:
                raise ValueError(f"Invalid lap number: {lap_number}") from e
    
        result = get_telemetry(
            sanitized_args["year"],
            str(arguments["event_identifier"]),
            str(arguments["session_name"]),
            str(arguments["driver_identifier"]),
            lap_number,
        )
  • Input schema validation definition for the get_telemetry tool, specifying parameters, types, descriptions, and required fields.
        inputSchema={
            "type": "object",
            "properties": {
                "year": {
                    "type": "number",
                    "description": "Season year (e.g., 2023)",
                },
                "event_identifier": {
                    "type": "string",
                    "description": (
                        "Event name or round number (e.g., 'Monaco' or '7')"
                    ),
                },
                "session_name": {
                    "type": "string",
                    "description": (
                        "Session name (e.g., 'Race', 'Qualifying', "
                        "'Sprint', 'FP1', 'FP2', 'FP3')"
                    ),
                },
                "driver_identifier": {
                    "type": "string",
                    "description": (
                        "Driver identifier (number, code, or name; "
                        "e.g., '44', 'HAM', 'Hamilton')"
                    ),
                },
                "lap_number": {
                    "type": "number",
                    "description": (
                        "Lap number (optional, gets fastest lap if not "
                        "provided)"
                    ),
                },
            },
            "required": [
                "year",
                "event_identifier",
                "session_name",
                "driver_identifier",
            ],
        },
    ),
  • Secondary registration in the HTTP bridge that directly maps and calls the get_telemetry function.
    'get_telemetry': get_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 but only states what the tool does, not how it behaves. It doesn't mention response format, data structure, error conditions, rate limits, authentication requirements, or whether this is a read-only operation (though 'Get' implies reading).

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 a single, focused sentence that efficiently communicates the core purpose without unnecessary words. It's appropriately sized for a tool with well-documented parameters and gets straight to the point with zero wasted content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with comprehensive parameter documentation but no output schema, the description is minimally adequate. It clearly states what data is retrieved but doesn't describe the return format, data fields, or any limitations. With no annotations and no output schema, more behavioral context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing complete parameter documentation. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline of 3. It doesn't explain relationships between parameters or provide usage examples.

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 specific action ('Get') and resource ('telemetry data for a specific Formula One lap'), distinguishing it from sibling tools like get_driver_info or get_session_results which focus on different data types. It precisely defines the scope as lap-level telemetry rather than broader performance metrics.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like analyze_driver_performance or get_session_results. It doesn't mention prerequisites, exclusions, or typical use cases, leaving the agent to infer usage from the tool name and parameters alone.

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/notsedano/f1-mcp-server'

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