import json
from pydantic import Field
from fastmcp import FastMCP
from .base_tools import BaseTools
from ..utils import launch_request_f1db
class RaceTools(BaseTools):
def __init__(self, mcp: FastMCP):
super().__init__(mcp=mcp)
BASE_PATH = "/races"
@staticmethod
def get_free_practice_1_by_id(race_id: int) -> json:
"""
Get a driver's list result of free practice 1 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of free practice 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/1")
@staticmethod
def get_free_practice_1_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of free practice 1 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of free practice 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/1/{driver_id}")
@staticmethod
def get_free_practice_2_by_id(race_id: int) -> json:
"""
Get a driver's list result of free practice 2 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver's list result of free practice 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/2")
@staticmethod
def get_free_practice_2_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of free practice 2 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of free practice 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/2/{driver_id}")
@staticmethod
def get_free_practice_3_by_id(race_id: int) -> json:
"""
Get a driver's list result of free practice 3 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of free practice 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/3")
@staticmethod
def get_free_practice_3_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of free practice 3 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of free practice 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/3/{driver_id}")
@staticmethod
def get_free_practice_4_by_id(race_id: int) -> json:
"""
Get a driver's list result of free practice 4 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of free practice 4 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/4")
@staticmethod
def get_free_practice_4_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of free practice 4 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of free practice 4 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/free_practice/4/{driver_id}")
@staticmethod
def get_qualy_1_by_id(race_id: int) -> json:
"""
Get a driver's list result of qualy 1 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of qualy 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/1")
@staticmethod
def get_qualy_1_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of qualy 1 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of qualy 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/1/{driver_id}")
@staticmethod
def get_qualy_2_by_id(race_id: int) -> json:
"""
Get a driver's list result of qualy 2 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of qualy 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/2")
@staticmethod
def get_qualy_2_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of qualy 2 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of qualy 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/2/{driver_id}")
@staticmethod
def get_qualy_3_by_id(race_id: int) -> json:
"""
Get a driver's list result of qualy 3 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of qualy 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/3")
@staticmethod
def get_qualy_3_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of qualy 3 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of qualy 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/3/{driver_id}")
@staticmethod
def get_pre_qualy_result_by_id(race_id: int) -> json:
"""
Get a driver's list pre result of qualy of specific race
:param race_id: Race id, int
:return: json with the driver's list pre result of qualy of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/pre")
@staticmethod
def get_pre_qualy_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver pre result of qualy of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver pre result of qualy of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/qualy/pre/{driver_id}")
@staticmethod
def get_starting_grid_by_id(race_id: int) -> json:
"""
Get a driver's list starting grid of the race of specific race
:param race_id: Race id, int
:return: json with the driver's list starting grid of the race of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/grid")
@staticmethod
def get_starting_grid_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver starting grid of the race of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver starting grid of the race of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/grid/{driver_id}")
@staticmethod
def get_driver_of_the_day_by_id(race_id: int) -> json:
"""
Get driver of the day of specific race
:param race_id: Race id, int
:return: json with the driver of the day of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/driver_of_the_day")
@staticmethod
def get_fastest_lap_by_id(race_id: int) -> json:
"""
Get the driver with the fastest lap of specific race
:param race_id: Race id, int
:return: json with the driver with the fastest lap of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/fastest_lap")
@staticmethod
def get_fastest_lap_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver fastest lap of the race of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver fastest lap of the race of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/fastest_lap/{driver_id}")
@staticmethod
def get_race_result_by_id(race_id: int) -> json:
"""
Get race result of specific race
:param race_id: Race id, int
:return: json with the race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race")
@staticmethod
def get_race_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get driver race result of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/race/{driver_id}")
@staticmethod
def get_sprint_qualy_1_result_by_id(race_id: int) -> json:
"""
Get a driver's list result of sprint qualy 1 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of sprint qualy 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/1")
@staticmethod
def get_sprint_qualy_1_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of sprint qualy 1 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of sprint qualy 1 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/1/{driver_id}")
@staticmethod
def get_sprint_qualy_2_result_by_id(race_id: int) -> json:
"""
Get a driver's list result of sprint qualy 2 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of sprint qualy 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/2")
@staticmethod
def get_sprint_qualy_2_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of sprint qualy 2 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of sprint qualy 2 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/2/{driver_id}")
@staticmethod
def get_sprint_qualy_3_result_by_id(race_id: int) -> json:
"""
Get a driver's list result of sprint qualy 3 of specific race
:param race_id: Race id, int
:return: json with the driver's list result of sprint qualy 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/3")
@staticmethod
def get_sprint_qualy_3_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of sprint qualy 3 of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of sprint qualy 3 of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/3/{driver_id}")
@staticmethod
def get_sprint_qualy_by_id(race_id: int) -> json:
"""
Get a driver's list result of sprint qualy of specific race
:param race_id: Race id, int
:return: json with the driver's list result of sprint qualy of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy")
@staticmethod
def get_sprint_qualy_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver result of sprint qualy of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver result of sprint qualy of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint_qualy/{driver_id}")
@staticmethod
def get_sprint_starting_grid_by_id(race_id: int) -> json:
"""
Get a driver's list sprint starting grid of the race of specific race
:param race_id: Race id, int
:return: json with the driver's list sprint starting grid of the race of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint/grid")
@staticmethod
def get_sprint_starting_grid_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get a driver sprint starting grid of the race of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver sprint starting grid of the race of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint/grid/{driver_id}")
@staticmethod
def get_sprint_race_result_by_id(race_id: int) -> json:
"""
Get sprint race result of specific race
:param race_id: Race id, int
:return: json with the sprint race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint")
@staticmethod
def get_sprint_race_result_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get driver sprint race result of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver sprint race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/sprint/{driver_id}")
@staticmethod
def get_warming_up_by_id(race_id: int) -> json:
"""
Get driver sprint race result of specific race
:param race_id: Race id, int
:return: json with the driver sprint race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/warming_up")
@staticmethod
def get_warming_up_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get driver sprint race result of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver sprint race result of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/warming_up/{driver_id}")
@staticmethod
def get_pit_stop_by_id(race_id: int) -> json:
"""
Get every pit stop of specific race in a list
:param race_id: Race id, int
:return: json with the every pit stop of specific race in a list
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/pit_stop")
@staticmethod
def get_pit_stop_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get every pit stop of one driver of specific race in a list
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the every pit stop of one driver of specific race in a list
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/pit_stop/{driver_id}")
@staticmethod
def get_gp_driver_summary_by_id_and_driver_id(race_id: int, driver_id: str) -> json:
"""
Get driver grand prix summary of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver grand prix summary of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/gp_wekend_summary/{driver_id}")
@staticmethod
def get_driver_standing_by_id(race_id: int) -> json:
"""
Get driver standing list of specific race
:param race_id: Race id, int
:return: json with the driver standing list of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/standings/drivers")
@staticmethod
def get_driver_standing_by_id_and_driver(race_id: int, driver_id: str) -> json:
"""
Get driver standing of specific race
:param race_id: Race id, int
:param driver_id: Driver id, str
:return: json with the driver standing of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/standings/drivers/{driver_id}")
@staticmethod
def get_constructor_standing_by_id(race_id: int) -> json:
"""
Get constructor standing list of specific race
:param race_id: Race id, int
:return: json with the constructor standing list of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/standings/constructors")
@staticmethod
def get_constructor_standing_by_id_and_constructor(race_id: int, constructor_id: str) -> json:
"""
Get constructor standing of specific race
:param race_id: Race id, int
:param constructor_id: Constructor id, str
:return: json with the constructor standing of specific race
"""
return launch_request_f1db(f"{RaceTools.BASE_PATH}/{race_id}/standings/constructors/{constructor_id}")