Skip to main content
Glama
notsedano

Formula One MCP Server

get_event_schedule

Fetch the Formula One race calendar for a specific season by providing the year. Access event schedules, race dates, and locations directly through the Formula One MCP Server.

Instructions

Get Formula One race calendar for a specific season

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesSeason year (e.g., 2023)

Implementation Reference

  • Core handler function implementing the get_event_schedule tool logic. Validates input year, fetches schedule using fastf1.get_event_schedule, converts to JSON-serializable format, handles errors.
    def get_event_schedule(year: Any) -> dict[str, Any]: """ Get the event schedule for a specified Formula One season. Args: year (int or str): The year of the F1 season Returns: dict: Status and schedule data or error information """ try: # Validate year year_int = validate_year(year) logger.debug(f"Fetching event schedule for {year_int}") schedule = fastf1.get_event_schedule(year_int) # Convert DataFrame to JSON serializable format result = [] for _, row in schedule.iterrows(): event_dict = row.to_dict() # Clean and convert non-serializable values clean_dict = {k: json_serial(v) for k, v in event_dict.items()} result.append(clean_dict) logger.info(f"Successfully retrieved {len(result)} events for {year_int}") return {"status": "success", "data": result} except Exception as e: logger.error(f"Error retrieving event schedule: {str(e)}", exc_info=True) return { "status": "error", "message": f"Failed to retrieve event schedule: {str(e)}", }
  • MCP tool schema definition including input schema for 'year' parameter.
    name="get_event_schedule", description=("Get Formula One race calendar for a specific season"), inputSchema={ "type": "object", "properties": { "year": { "type": "number", "description": "Season year (e.g., 2023)", }, }, "required": ["year"], }, ),
  • Registration and dispatch logic in the MCP server's @app.call_tool() handler that routes calls to get_event_schedule.
    if name == "get_event_schedule": if "year" not in sanitized_args: sanitized_args["year"] = int(arguments["year"]) result = get_event_schedule(sanitized_args["year"])
  • Tool registration in the HTTP bridge that maps tool name to the handler function.
    'get_event_schedule': get_event_schedule,
  • TypeScript schema definition for Gemini function calling, matching the MCP tool schema.
    name: 'get_event_schedule', description: 'Get Formula One race calendar/schedule for a specific season with all Grand Prix events', parameters: { type: SchemaType.OBJECT, properties: { year: { type: SchemaType.NUMBER, description: 'Season year (e.g., 2024, 2023, 2022). Must be between 1950 and current year.', } }, required: ['year'] }

Other Tools

Related 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/notsedano/f1-mcp-server'

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