Skip to main content
Glama
Josh-Mantel

F1 MCP Server

by Josh-Mantel

get_lap_times

Retrieve lap time data for Formula 1 sessions to analyze driver performance and session results by specifying season, round, and session type.

Instructions

Get lap times for a specific session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesSeason year (e.g., 2024)
round_numberYesRound number (1-24)
sessionYesSession type
driverNoDriver abbreviation (optional, e.g., 'VER', 'HAM')

Implementation Reference

  • The main handler function for the get_lap_times tool, which fetches lap times using FastF1.
    async def get_lap_times(arguments: Dict[str, Any]) -> List[TextContent]:
        """Get lap times for a session."""
        year = arguments["year"]
        round_number = arguments["round_number"]
        session_type = arguments["session"]
        driver_filter = arguments.get("driver")
    
        try:
            session = fastf1.get_session(year, round_number, session_type)
            session.load()
    
            laps = session.laps
    
            # Filter by driver if specified
            if driver_filter:
                laps = laps[laps["Driver"] == driver_filter.upper()]
    
            # Convert lap times to readable format
            lap_data = []
            for _, lap in laps.iterrows():
                lap_data.append(
                    {
                        "lap_number": (
                            int(lap["LapNumber"]) if pd.notna(lap["LapNumber"]) else None
                        ),
                        "driver": lap["Driver"],
                        "team": lap["Team"],
                        "lap_time": (
                            str(lap["LapTime"]) if pd.notna(lap["LapTime"]) else None
                        ),
                        "sector_1": (
                            str(lap["Sector1Time"])
                            if pd.notna(lap.get("Sector1Time"))
                            else None
                        ),
                        "sector_2": (
                            str(lap["Sector2Time"])
                            if pd.notna(lap.get("Sector2Time"))
                            else None
                        ),
                        "sector_3": (
  • Tool definition and registration for get_lap_times.
    Tool(
        name="get_lap_times",
        description="Get lap times for a specific session",
        inputSchema={
            "type": "object",
            "properties": {
                "year": {
                    "type": "integer",
                    "description": "Season year (e.g., 2024)",
                },
                "round_number": {
                    "type": "integer",
                    "description": "Round number (1-24)",
                },
                "session": {
                    "type": "string",
                    "description": "Session type",
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. It states the tool retrieves lap times but fails to mention critical details like whether it's a read-only operation, potential rate limits, authentication needs, or the format of returned data (e.g., structured list vs. raw). This leaves significant gaps in understanding how the tool behaves.

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, direct sentence with no unnecessary words, making it highly concise and front-loaded. It efficiently communicates the core purpose without any fluff or redundant information.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for a tool with 4 parameters and no behavioral context. It does not explain what the output looks like (e.g., list of lap times with details), potential errors, or usage constraints, leaving the agent with insufficient information to handle the tool effectively.

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?

The input schema has 100% description coverage, clearly documenting all parameters (year, round_number, session, driver) with details like enums for session. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for adequate but not enhanced parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('lap times for a specific session'), making the purpose understandable. However, it does not distinguish this tool from its siblings (e.g., get_session_results), which might also retrieve session-related data, leaving room for ambiguity in tool selection.

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 get_session_results or other sibling tools. It lacks context about prerequisites, such as needing a specific session type, and offers no explicit when-not-to-use or alternative recommendations.

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/Josh-Mantel/MCP-F1'

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