fast_mcp / app.py
dinho1597's picture
Update app.py
6fd208f verified
raw
history blame contribute delete
506 Bytes
# app.py
import random
from fastmcp import FastMCP
# 1. Se define la instancia de FastMCP como antes
mcp = FastMCP(name="Dice Roller")
@mcp.tool
def roll_dice(n_dice: int) -> list[int]:
"""
Lanza `n_dice` dados de 6 caras y devuelve los resultados.
Roll `n_dice` 6-sided dice and return the results.
"""
return [random.randint(1, 6) for _ in range(n_dice)]
# 2. Se crea explícitamente el objeto de la aplicación ASGI
# Uvicorn buscará esta variable 'app'.
app = mcp.http_app()