Skip to main content
Glama
Josh-Mantel

F1 MCP Server

by Josh-Mantel

get_constructor_standings

Retrieve Formula 1 constructor championship standings for any season, optionally after specific race rounds, to track team performance and rankings.

Instructions

Get constructor championship standings for a season

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesSeason year (e.g., 2024)
round_numberNoRound number (optional, gets standings after this round)

Implementation Reference

  • The handler function that executes the logic to fetch and compute constructor standings using FastF1.
    async def get_constructor_standings(arguments: Dict[str, Any]) -> List[TextContent]:
        """Get constructor championship standings."""
        year = arguments["year"]
        round_number = arguments.get("round_number")
    
        try:
            # Get the schedule to determine which round to use
            schedule = fastf1.get_event_schedule(year)
    
            if round_number is None:
                # Get latest completed round
                current_date = datetime.now()
                completed_rounds = schedule[schedule["EventDate"] <= current_date]
                if completed_rounds.empty:
                    round_number = 1
                else:
                    round_number = int(completed_rounds["RoundNumber"].max())
    
            # Get race session for standings calculation
            session = fastf1.get_session(year, round_number, "R")
            session.load()
    
            results = session.results
    
            # Group by team and sum points
            team_points = {}
            for _, driver in results.iterrows():
                team = driver["TeamName"]
                points = float(driver["Points"]) if pd.notna(driver.get("Points", 0)) else 0
    
                if team not in team_points:
                    team_points[team] = {"points": 0, "drivers": []}
    
                team_points[team]["points"] += points
                team_points[team]["drivers"].append(
                    {
                        "name": driver["FullName"],
                        "abbreviation": driver["Abbreviation"],
                        "points": points,
                    }
                )
  • The tool registration for 'get_constructor_standings' in the MCP server.
    name="get_constructor_standings",
    description="Get constructor championship standings for a season",
    inputSchema={
        "type": "object",
        "properties": {
            "year": {
                "type": "integer",
                "description": "Season year (e.g., 2024)",
            },
            "round_number": {
                "type": "integer",
                "description": "Round number (optional, gets standings after this round)",
  • The dispatch logic in the main tool handler that routes requests to the get_constructor_standings function.
    elif name == "get_constructor_standings":
        return await get_constructor_standings(arguments)

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