Skip to main content
Glama

get_stints_live

Track real-time Formula 1 tire stints during races and sessions. Filter data by driver, compound, or session to analyze pit stop strategies.

Instructions

Get real-time tire stint tracking from OpenF1.

Args: year: Season year (2023+, OpenF1 data availability) country: Country name (e.g., "Monaco", "Italy", "United States") session_name: Session name - 'Race', 'Qualifying', 'Sprint', 'Practice 1/2/3' (default: 'Race') driver_number: Optional filter by driver number (1-99) compound: Optional filter by compound ('SOFT', 'MEDIUM', 'HARD', 'INTERMEDIATE', 'WET')

Returns: StintsResponse with tire stint data

Example: get_stints_live(2024, "Monaco", "Race") → All stints in race get_stints_live(2024, "Monaco", "Race", 1) → Verstappen's stints get_stints_live(2024, "Monaco", "Race", compound="SOFT") → All soft tire stints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes
countryYes
session_nameNoRace
driver_numberNo
compoundNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearNoYear
stintsYesList of tire stints
countryNoCountry name
session_nameNoSession name
total_stintsYesTotal number of stints

Implementation Reference

  • Main handler function for get_stints_live tool. Fetches live tire stint data from OpenF1 API using meeting/session keys, applies optional filters for driver and compound, converts raw data to Pydantic models (StintData), and returns structured StintsResponse.
    def get_stints_live(
        year: int,
        country: str,
        session_name: str = "Race",
        driver_number: Optional[int] = None,
        compound: Optional[str] = None
    ) -> StintsResponse:
        """
        Get real-time tire stint tracking from OpenF1.
    
        Args:
            year: Season year (2023+, OpenF1 data availability)
            country: Country name (e.g., "Monaco", "Italy", "United States")
            session_name: Session name - 'Race', 'Qualifying', 'Sprint', 'Practice 1/2/3' (default: 'Race')
            driver_number: Optional filter by driver number (1-99)
            compound: Optional filter by compound ('SOFT', 'MEDIUM', 'HARD', 'INTERMEDIATE', 'WET')
    
        Returns:
            StintsResponse with tire stint data
    
        Example:
            get_stints_live(2024, "Monaco", "Race") → All stints in race
            get_stints_live(2024, "Monaco", "Race", 1) → Verstappen's stints
            get_stints_live(2024, "Monaco", "Race", compound="SOFT") → All soft tire stints
        """
        # Get meeting and session info
        meetings = openf1_client.get_meetings(year=year, country_name=country)
        if not meetings:
            return StintsResponse(
                session_name=session_name,
                year=year,
                country=country,
                stints=[],
                total_stints=0
            )
    
        # Get sessions for this meeting
        sessions = openf1_client.get_sessions(year=year, country_name=country, session_name=session_name)
        if not sessions:
            return StintsResponse(
                session_name=session_name,
                year=year,
                country=country,
                stints=[],
                total_stints=0
            )
    
        session = sessions[0]
        session_key = session['session_key']
    
        # Get stint data
        stint_data = openf1_client.get_stints(
            session_key=session_key,
            driver_number=driver_number,
            compound=compound
        )
    
        # Convert to Pydantic models
        stints = [
            StintData(
                stint_number=stint['stint_number'],
                driver_number=stint['driver_number'],
                compound=stint['compound'],
                lap_start=stint['lap_start'],
                lap_end=stint['lap_end'],
                tyre_age_at_start=stint['tyre_age_at_start']
            )
            for stint in stint_data
        ]
    
        return StintsResponse(
            session_name=session_name,
            year=year,
            country=country,
            stints=stints,
            total_stints=len(stints)
        )
  • Pydantic models for input validation and structured output: StintData for individual stints and StintsResponse for the tool's return type.
    class StintData(BaseModel):
        """Tire stint data."""
        stint_number: int = Field(..., description="Stint number")
        driver_number: int = Field(..., description="Driver number (1-99)")
        compound: str = Field(..., description="Tire compound (SOFT, MEDIUM, HARD, etc.)")
        lap_start: Optional[int] = Field(None, description="Starting lap number")
        lap_end: Optional[int] = Field(None, description="Ending lap number")
        tyre_age_at_start: int = Field(..., description="Tyre age at start of stint")
    
    
    class StintsResponse(BaseModel):
        """Response for tire stint data."""
        session_name: Optional[str] = Field(None, description="Session name")
        year: Optional[int] = Field(None, description="Year")
        country: Optional[str] = Field(None, description="Country name")
        stints: list[StintData] = Field(..., description="List of tire stints")
        total_stints: int = Field(..., description="Total number of stints")
  • server.py:172-172 (registration)
    MCP tool registration decorator applied to the get_stints_live handler function.
    mcp.tool()(get_stints_live)
  • Exported in tools __all__ for import in server.py.
    "get_stints_live",
  • Listed in tools/live __all__ and imported from stints.py.
    "get_stints_live",
Behavior3/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. It mentions 'real-time' and OpenF1 data availability, which adds useful context about data freshness and source. However, it doesn't describe error handling, rate limits, authentication needs, or what 'real-time' precisely means (e.g., live session updates). The description doesn't contradict any annotations since none exist.

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 well-structured and front-loaded with the core purpose, followed by Args, Returns, and Example sections. Every sentence earns its place by providing essential information without redundancy. The examples are concise yet illustrative of different filtering scenarios.

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 moderate complexity (5 parameters, no annotations, but with output schema), the description is largely complete. It covers all parameters thoroughly and indicates the return type (StintsResponse). However, it could benefit from more behavioral context (e.g., data latency, error cases) since annotations are absent. The output schema existence reduces the need to detail return values.

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 description coverage is 0%, so the description must fully compensate. It provides detailed semantics for all 5 parameters: year (season year with availability note), country (examples given), session_name (options listed with default), driver_number (optional filter with range), and compound (optional filter with allowed values). The examples further clarify usage. This adds significant value beyond the bare schema.

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: 'Get real-time tire stint tracking from OpenF1.' It specifies the exact resource (tire stint data), source (OpenF1), and temporal aspect (real-time). This distinguishes it from sibling tools like get_tire_strategy or get_laps, which likely provide different types of tire or 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 for usage through the examples, showing how to filter by driver number or compound. However, it doesn't explicitly state when to use this tool versus alternatives like get_tire_strategy or get_laps, nor does it mention any prerequisites or exclusions beyond the data availability note for year.

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