Skip to main content
Glama

get_session_drivers

Retrieve all driver identifiers who participated in a specific Formula 1 session by providing the year, Grand Prix, and session type.

Instructions

Get list of drivers who participated in a session.

Retrieves all driver identifiers who took part in the specified session.

Args: year: The season year (2018 onwards) gp: The Grand Prix name (e.g., 'Monza', 'Monaco') or round number session: Session type - 'FP1', 'FP2', 'FP3', 'Q', 'S', 'R'

Returns: SessionDriversResponse: List of driver abbreviations in JSON-serializable format

Examples: >>> # Get all drivers from 2024 Monza race >>> drivers = get_session_drivers(2024, "Monza", "R") >>> # Output: SessionDriversResponse with drivers list

>>> # Get drivers from Free Practice 1 >>> fp1_drivers = get_session_drivers(2024, "Monaco", "FP1")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gpYes
sessionYes
yearYes

Implementation Reference

  • Main handler function for get_session_drivers tool. Fetches session data using FastF1Client, extracts drivers list, and returns structured response.
    def get_session_drivers(year: int, gp: Union[str, int], session: str) -> SessionDriversResponse: """ Get list of drivers who participated in a session. Retrieves all driver identifiers who took part in the specified session. Args: year: The season year (2018 onwards) gp: The Grand Prix name (e.g., 'Monza', 'Monaco') or round number session: Session type - 'FP1', 'FP2', 'FP3', 'Q', 'S', 'R' Returns: SessionDriversResponse: List of driver abbreviations in JSON-serializable format Examples: >>> # Get all drivers from 2024 Monza race >>> drivers = get_session_drivers(2024, "Monza", "R") >>> # Output: SessionDriversResponse with drivers list >>> # Get drivers from Free Practice 1 >>> fp1_drivers = get_session_drivers(2024, "Monaco", "FP1") """ session_obj = fastf1_client.get_session(year, gp, session) session_obj.load(laps=False, telemetry=False, weather=False, messages=False) drivers_list = session_obj.drivers.tolist() if hasattr(session_obj.drivers, 'tolist') else list(session_obj.drivers) event = session_obj.event return SessionDriversResponse( session_name=session_obj.name, event_name=event['EventName'], year=year, drivers=drivers_list, total_drivers=len(drivers_list) )
  • Pydantic BaseModel defining the output schema for the get_session_drivers tool response.
    class SessionDriversResponse(BaseModel): """Session drivers response.""" session_name: str = Field(description="Session name") event_name: str = Field(description="Grand Prix name") year: int = Field(description="Season year") drivers: list[str] = Field(description="List of driver abbreviations") total_drivers: int = Field(description="Total number of drivers")
  • server.py:152-152 (registration)
    Registers the get_session_drivers function as an MCP tool using the mcp.tool() decorator.
    mcp.tool()(get_session_drivers)
  • Global FastF1Client instance used by the get_session_drivers handler to fetch session data.
    from clients.fastf1_client import FastF1Client from typing import Union from models.sessions import SessionDriversResponse # Initialize FastF1 client fastf1_client = FastF1Client()
  • Re-exports the get_session_drivers function from the drivers submodule.
    from .drivers import get_session_drivers

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