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
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | Season year (e.g., 2024) | |
| round_number | No | Round number (optional, gets standings after this round) |
Implementation Reference
- f1_mcp_server/server.py:388-428 (handler)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, } ) - f1_mcp_server/server.py:133-144 (registration)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)", - f1_mcp_server/server.py:192-193 (handler)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)