import json
from pydantic import Field
from fastmcp import FastMCP
from .base_tools import BaseTools
from ..utils import launch_request_f1db
class ManufacturerTools(BaseTools):
def __init__(self, mcp: FastMCP):
super().__init__(mcp=mcp)
BASE_PATH = "/manufacturers"
@staticmethod
def get_tyre_manufacturer_by_id(tyre_manufacturer_id: str) -> json:
"""
Get tyre manufacturer information:
id, str
name, str
country_id, str
best_starting_grid_position, int
best_race_result, int
total_race_entries, int
total_race_starts, int
total_race_wins, int
total_race_laps, int
total_podiums, int
total_podium_races, int
total_pole_positions, int
total_fastest_laps, int
"""
result = launch_request_f1db(f"{ManufacturerTools.BASE_PATH}/tyres/{tyre_manufacturer_id}")
return result
@staticmethod
def search_tyre_manufacturer(tyre_manufacturer: str) -> json:
"""
Search a scpecific tyre manufacturer along of F1 history.
Use it when you are searching only one:
id, str
name, str
country_id, str
best_starting_grid_position, int
best_race_result, int
total_race_entries, int
total_race_starts, int
total_race_wins, int
total_race_laps, int
total_podiums, int
total_podium_races, int
total_pole_positions, int
total_fastest_laps, int
"""
result = launch_request_f1db(f"{ManufacturerTools.BASE_PATH}/tyres/search",data={"tyre_manufacturer":tyre_manufacturer})
return result
@staticmethod
def get_engine_manufacturer_by_id(engine_manufacturer_id: str) -> json:
"""
Get engine manufacturer information:
id, str
name, str
country_id, str
best_championship_position, int
best_starting_grid_position, int
best_race_result, int
total_race_entries, int
total_race_starts, int
total_race_wins, int
total_race_laps, int
total_podiums, int
total_podium_races, int
total_points, float
total_championship_points, float
total_pole_positions, int
total_fastest_laps, int
"""
result = launch_request_f1db(f"{ManufacturerTools.BASE_PATH}/engines/{engine_manufacturer_id}")
return result
@staticmethod
def search_engine_manufacturer(engine_manufacturer: str) -> json:
"""
Search a scpecific engine manufacturer along of F1 history.
Use it when you are searching only one:
id, str
name, str
country_id, str
best_championship_position, int
best_starting_grid_position, int
best_race_result, int
total_race_entries, int
total_race_starts, int
total_race_wins, int
total_race_laps, int
total_podiums, int
total_podium_races, int
total_points, float
total_championship_points, float
total_pole_positions, int
total_fastest_laps, int
"""
result = launch_request_f1db(f"{ManufacturerTools.BASE_PATH}/engines/search", data={"engine_manufacturer":engine_manufacturer})
return result