REST endpoints for AI agents Β· Powered by OpenF1 Β· Built for FOMO Pitwall Agent

πŸ€– These endpoints are designed for AI agent consumption. All responses are JSON with clean, structured data ready for LLM processing. CORS enabled on all routes.

πŸ”΄ Live Timing

GET/api/agent/live

Current session timing β€” positions, gaps, sectors, tyre data for all drivers. Auto-fetches latest active session.

No parameters required. Returns latest OpenF1 session automatically.

{
  "session": {
    "key": 11228,
    "name": "Race",
    "type": "Race",
    "status": "green",
    "circuit": "Albert Park",
    "country": "Australia",
    "year": 2026,
    "remaining": "00:45:12"
  },
  "drivers": [
    {
      "pos": 1,
      "driver": "PIA",
      "full_name": "Oscar Piastri",
      "team": "McLaren",
      "gap": "leader",
      "interval": "--",
      "best_lap": "1:19.729",
      "last_lap": "1:20.011",
      "tyre": "soft",
      "tyre_age": 14,
      "laps": 27,
      "s1": "28.114",
      "s2": "19.832",
      "s3": "31.783"
    }
  ]
}
β†’ Try it live

🧠 Race Strategy

GET/api/agent/strategy

Simulates 6 race strategies for a driver using real lap data + degradation model. Returns ranked recommendations with time deltas.

ParamTypeDefaultDescription
session_keynumberlatestOpenF1 session key
driverstringP1 driverDriver acronym (PIA, VER, LEC…) or number
{
  "driver": "PIA",
  "team": "McLaren Racing",
  "race_params": {
    "total_laps": 58,
    "pit_loss_seconds": 22,
    "best_lap_time": "1:19.729"
  },
  "recommended_strategies": [
    {
      "rank": 1,
      "stops": 2,
      "label": "2-stop S→M→H",
      "compounds": ["soft", "medium", "hard"],
      "estimated_race_time": "1:27:34.211",
      "delta": "+0.000",
      "delta_seconds": 0
    }
  ],
  "optimal_strategy": { "..." }
}
β†’ Try: VER strategy AUS 2025

πŸ“Š Session Analysis

GET/api/agent/analysis

Full session analysis: pace ranking, team comparison, long-run pace, best sectors, speed trap, and AI-style key insights.

ParamTypeDefaultDescription
session_keynumberlatestOpenF1 session key
{
  "session": "FP1 β€” Australia 2026",
  "pace_ranking": [
    {
      "pos": 1,
      "driver": "LEC",
      "team": "Ferrari",
      "best_lap": "1:20.267",
      "gap_to_leader": 0,
      "laps_completed": 22
    }
  ],
  "team_pace": [{ "pos": 1, "team": "Ferrari", "best_lap": "1:20.267" }],
  "long_run_pace": [{ "driver": "NOR", "compound": "medium", "laps": 12, "avg_lap": "1:22.1", "deg_per_lap": "+0.08s/lap" }],
  "key_insights": [
    "Ferrari showed strongest single-lap pace in FP1",
    "McLaren led FP2 with Piastri P1"
  ]
}
β†’ Try: AUS 2025 Race analysis

πŸ—“οΈ Calendar

GET/api/agent/calendar

Full season calendar with upcoming sessions, countdowns, and race times in UTC and UTC-3 (Buenos Aires).

ParamTypeDefaultDescription
yearnumbercurrent yearSeason year
upcomingbooleantruefalse = return full calendar
{
  "next_session": {
    "name": "Race",
    "country": "Bahrain",
    "date": "2026-03-15T15:00:00+00:00",
    "countdown": "8d 14h"
  },
  "upcoming_sessions": [{ "..." }],
  "upcoming_races": [
    {
      "name": "Bahrain Grand Prix",
      "circuit": "Bahrain International Circuit",
      "race_date": "2026-03-15T15:00:00+00:00",
      "race_date_ar": "2026-03-15 12:00 ART",
      "countdown": "8d 14h"
    }
  ]
}
β†’ Try: 2025 calendar

πŸ“‘ Telemetry

GET/api/agent/telemetry

Raw telemetry for a specific lap: speed, throttle, brake, gear, DRS, RPM. Use lap=fastest for best lap.

ParamTypeDefaultDescription
session_keynumberlatestOpenF1 session key
driverstringfirst driverDriver acronym or number
lapnumber|"fastest"fastestLap number or "fastest"
{
  "driver": "LEC",
  "lap": { "number": 42, "duration_formatted": "1:20.267", "is_fastest": true },
  "summary": { "max_speed_kmh": 327, "avg_throttle_pct": 68.4 },
  "telemetry": [
    { "t": 0, "distance_km": 0, "speed": 180, "throttle": 100, "brake": 0, "gear": 6 },
    "... up to 300 data points per lap"
  ]
}
β†’ Try: VER fastest lap AUS 2025

⚑ MCP Server (Claude / FAMA integration)

The mcp-server.js exposes 4 tools for direct integration with Claude/FAMA via the Model Context Protocol.

Available Tools

ToolDescription
f1_live_timingCurrent session state β€” positions, gaps, tyres, sectors
f1_strategy_analysisRace strategy recommendations for a driver
f1_session_analysisFull pace analysis β€” ranking, teams, sectors, insights
f1_upcoming_sessionsNext races & sessions with countdowns

Run the server

cd /path/to/f1-live
node mcp-server.js

Connect to OpenClaw (claude_desktop_config.json)

{
  "mcpServers": {
    "f1-live": {
      "command": "node",
      "args": ["/path/to/f1-live/mcp-server.js"],
      "env": {
        "F1_API_BASE": "https://f1.fomo.com.ar"
      }
    }
  }
}

Connect to FOMO fomo-core agent

# In fomo-core agent config, add HTTP tool pointing to:
GET https://f1.fomo.com.ar/api/agent/live
GET https://f1.fomo.com.ar/api/agent/strategy?driver={driver}&session_key={session_key}
GET https://f1.fomo.com.ar/api/agent/analysis?session_key={session_key}
GET https://f1.fomo.com.ar/api/agent/calendar