Skip to main content
Glama

get_session_drivers

Retrieve driver identifiers for a specific Formula 1 session by providing year, Grand Prix, and session type to get participant lists.

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
yearYes
gpYes
sessionYes

Implementation Reference

  • The main handler function that implements the get_session_drivers tool. It fetches the session using FastF1Client, loads minimal data, extracts drivers list, and returns a structured SessionDriversResponse.
    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 model defining the output schema for the get_session_drivers tool response, including session details and list of drivers.
    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)
    MCP tool registration decorator applied to the get_session_drivers function.
    mcp.tool()(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