Skip to main content
Glama
Josh-Mantel

F1 MCP Server

by Josh-Mantel

get_session_results

Retrieve Formula 1 session results for practice, qualifying, or race by specifying year, round number, and session type.

Instructions

Get results for a specific F1 session (practice, qualifying, or race)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesSeason year (e.g., 2024)
round_numberYesRound number (1-24)
sessionYesSession type

Implementation Reference

  • The asynchronous function `get_session_results` that fetches session data using FastF1, processes it into a list of dictionaries, and returns the result wrapped in a `TextContent` object.
    async def get_session_results(arguments: Dict[str, Any]) -> List[TextContent]:
        """Get session results."""
        year = arguments["year"]
        round_number = arguments["round_number"]
        session_type = arguments["session"]
    
        try:
            session = fastf1.get_session(year, round_number, session_type)
            session.load()
    
            results = session.results
    
            # Convert results to readable format
            results_data = []
            for _, driver in results.iterrows():
                results_data.append(
                    {
                        "position": (
                            int(driver["Position"])
                            if pd.notna(driver["Position"])
                            else None
                        ),
                        "driver_number": (
                            int(driver["DriverNumber"])
                            if pd.notna(driver["DriverNumber"])
                            else None
                        ),
                        "driver": driver["Abbreviation"],
                        "full_name": driver["FullName"],
                        "team": driver["TeamName"],
                        "time": str(driver["Time"]) if pd.notna(driver["Time"]) else None,
                        "status": driver["Status"] if "Status" in driver else None,
                        "points": (
                            float(driver["Points"])
                            if pd.notna(driver.get("Points", 0))
                            else 0
                        ),
                    }
                )
    
            result = {
                "year": year,
                "round": round_number,
                "session": session_type,
                "event_name": session.event["EventName"],
                "location": session.event["Location"],
                "results": results_data,
            }
    
            return [
                TextContent(
                    type="text",
                    text=f"F1 {year} Round {round_number} {session_type} Results:\n\n"
                    + json.dumps(result, indent=2),
                )
            ]
    
        except Exception as e:
            return [
                TextContent(type="text", text=f"Error getting session results: {str(e)}")
            ]
  • The `Tool` definition for `get_session_results`, which defines the input schema (year, round_number, session).
    Tool(
        name="get_session_results",
        description="Get results for a specific F1 session (practice, qualifying, or race)",
        inputSchema={
            "type": "object",
            "properties": {
                "year": {
                    "type": "integer",
                    "description": "Season year (e.g., 2024)",
                },
                "round_number": {
                    "type": "integer",
                    "description": "Round number (1-24)",
                    "minimum": 1,
                    "maximum": 24,
                },
                "session": {
                    "type": "string",
                    "description": "Session type",
                    "enum": ["FP1", "FP2", "FP3", "Q", "R"],
                },
            },
            "required": ["year", "round_number", "session"],
        },
    ),
  • The call handler logic inside `call_tool` that routes the `get_session_results` tool name to its handler function.
    elif name == "get_session_results":
        return await get_session_results(arguments)
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 adds minimal context. It states what the tool does but doesn't describe response format, error handling, rate limits, authentication needs, or whether it's read-only or mutative. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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, efficient sentence that front-loads the core purpose without unnecessary words. Every element ('Get results for a specific F1 session') directly contributes to understanding, and the parenthetical clarification ('practice, qualifying, or race') adds useful context without verbosity.

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 tool's moderate complexity (3 required parameters, no output schema, no annotations), the description is incomplete. It adequately states the purpose but lacks behavioral context, usage guidelines, and output information. For a data retrieval tool with no structured output documentation, more detail on what 'results' entail 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%, so the schema already documents all three parameters thoroughly with descriptions, constraints, and enums. The description adds no additional parameter semantics beyond what's in the schema, such as explaining relationships between parameters or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Get') and resource ('results for a specific F1 session'), making it immediately understandable. It distinguishes the resource type (session results) from siblings like standings or schedules, though it doesn't explicitly differentiate from 'get_lap_times' which might overlap in data scope.

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. It doesn't mention prerequisites, context for selecting session types, or how it differs from sibling tools like 'get_lap_times' that might provide related data. Usage is implied by the purpose but not explicitly directed.

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