get_random_recipe
Get a random Christmas recipe to solve meal planning challenges and inspire holiday cooking.
Instructions
Returns a random Christmas recipe.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:165-168 (registration)Registration of the 'get_random_recipe' tool using the @mcp.tool decorator, specifying its name and description.@mcp.tool( name="get_random_recipe", description="Returns a random Christmas recipe.", )
- main.py:169-171 (handler)The handler function for 'get_random_recipe'. It selects a random recipe from the christmas_recipes() list and returns it as a dictionary using model_dump().async def get_random_recipe() -> Dict: """Retourne une recette de Noël au hasard.""" return random.choice(christmas_recipes()).model_dump()
- main.py:99-140 (helper)Helper function 'christmas_recipes()' that provides the list of hardcoded Christmas recipes used by the get_random_recipe tool.def christmas_recipes() -> List[Recipe]: """Liste de recettes de Noël.""" return [ Recipe( name="Dinde de Noël", category="Plat principal", servings=8, ingredients={"dinde": "1", "marrons": "500g", "beurre": "100g", "sel": "1 pincée", "poivre": "1 pincée"}, instructions=[ "Préchauffer le four à 180°C.", "Farcir la dinde avec les marrons.", "Badigeonner de beurre, saler et poivrer.", "Enfourner pour 3 heures.", ], wine_pairing="Bourgogne rouge", ), Recipe( name="Bûche de Noël", category="Dessert", servings=6, ingredients={"chocolat noir": "200g", "beurre": "100g", "sucre": "150g", "oeufs": "4", "farine": "50g"}, instructions=[ "Faire fondre le chocolat avec le beurre.", "Ajouter le sucre, les oeufs et la farine.", "Verser sur une plaque et cuire 10 minutes.", "Rouler la bûche et la laisser refroidir.", ], wine_pairing="Champagne", ), Recipe( name="Saumon fumé sur blinis", category="Entrée", servings=4, ingredients={"saumon fumé": "4 tranches", "blinis": "8", "crème fraîche": "100g", "ciboulette": "1 botte"}, instructions=[ "Tartiner les blinis de crème fraîche.", "Ajouter une tranche de saumon fumé.", "Ciseler la ciboulette et en parsemer les blinis.", ], wine_pairing="Sancerre", ), ]
- main.py:50-57 (schema)Pydantic BaseModel 'Recipe' defining the structure for recipes, used in christmas_recipes() and returned by the tool.class Recipe(BaseModel): name: str category: str # "Entrée", "Plat principal", "Dessert" servings: int ingredients: Dict[str, str] # e.g., {"chocolat noir": "200g"} instructions: List[str] wine_pairing: Optional[str] = None