File size: 1,263 Bytes
d4991e4 014f597 1d0b9d1 d4991e4 1d0b9d1 d4991e4 014f597 1d0b9d1 87a229b 1d0b9d1 014f597 1d0b9d1 014f597 1d0b9d1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import random
import gradio as gr
def driver_championship_score(driver_name: str) -> str:
"""
Get the championship score for the given driver.
Args:
driver_name (str): The driver's name
Returns:
int: The driver's championship score
"""
return f"Driver {driver_name} has {random.randint(0, 100)} championship points"
def driver_position(driver_name: str) -> str:
"""
Get the current position of the given driver.
Args:
driver_name (str): The driver's name
Returns:
str: The driver's current position
"""
return f"Driver {driver_name} is in position {random.randint(1, 20)}"
# Create interfaces for each tool
iface1 = gr.Interface(
fn=driver_championship_score,
inputs="text",
outputs="text",
title="[Dummy] Driver Championship Score"
)
iface2 = gr.Interface(
fn=driver_position,
inputs="text",
outputs="text",
title="[Dummy] Driver Position"
)
# Combine into tabs into server
gradio_server = gr.TabbedInterface(
[iface1, iface2],
tab_names=["Driver Championship Score", "Driver Position"],
title="Formula 1 MCP server"
)
# Launch the interface and MCP server
if __name__ == "__main__":
gradio_server.launch(mcp_server=True) |