Skip to main content
Glama
rakeshgangwar

Formula One MCP Server

get_driver_info

Retrieve detailed information about a specific Formula One driver, including their performance statistics for a given year, event, and session, using the Formula One MCP Server.

Instructions

Get information about a specific Formula One driver

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
driver_identifierYesDriver identifier (number, code, or name; e.g., "44", "HAM", "Hamilton")
event_identifierYesEvent name or round number (e.g., "Monaco" or "7")
session_nameYesSession name (e.g., "Race", "Qualifying", "Sprint", "FP1", "FP2", "FP3")
yearYesSeason year (e.g., 2023)

Implementation Reference

  • Core handler function that executes the tool logic: loads F1 session data and retrieves specific driver information using the fastf1 library.
    def get_driver_info(year, event_identifier, session_name, driver_identifier):
        """Get information about a specific driver"""
        try:
            year = int(year)
            session = fastf1.get_session(year, event_identifier, session_name)
            session.load(telemetry=False)  # Load session without telemetry for faster results
            
            driver_info = session.get_driver(driver_identifier)
            
            # Convert to JSON serializable format
            driver_dict = driver_info.to_dict()
            clean_dict = {k: json_serial(v) for k, v in driver_dict.items()}
            
            return {"status": "success", "data": clean_dict}
        except Exception as e:
            return {"status": "error", "message": str(e), "traceback": traceback.format_exc()}
  • Tool schema definition including name, description, and input validation schema for the get_driver_info tool.
    {
      name: 'get_driver_info',
      description: 'Get information about a specific Formula One driver',
      inputSchema: {
        type: 'object',
        properties: {
          year: {
            type: 'number',
            description: 'Season year (e.g., 2023)',
          },
          event_identifier: {
            type: 'string',
            description: 'Event name or round number (e.g., "Monaco" or "7")',
          },
          session_name: {
            type: 'string',
            description: 'Session name (e.g., "Race", "Qualifying", "Sprint", "FP1", "FP2", "FP3")',
          },
          driver_identifier: {
            type: 'string',
            description: 'Driver identifier (number, code, or name; e.g., "44", "HAM", "Hamilton")',
          },
        },
        required: ['year', 'event_identifier', 'session_name', 'driver_identifier'],
      },
    },
  • src/index.ts:317-326 (registration)
    MCP tool registration and dispatching logic in the CallToolRequest handler switch statement.
    case 'get_driver_info': {
      const typedArgs = args as DriverInfoArgs;
      result = await executePythonFunction('get_driver_info', [
        typedArgs.year.toString(),
        typedArgs.event_identifier.toString(),
        typedArgs.session_name.toString(),
        typedArgs.driver_identifier.toString(),
      ]);
      break;
    }
  • Internal registration of the get_driver_info function in the Python dispatch dictionary.
    "get_driver_info": get_driver_info,
Install Server

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

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