list_ingredients
Get a list of ingredients organized by cooking style to help plan meals and manage culinary resources.
Instructions
Returns a list of ingredients based on a simple style.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_ingredients"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | basics |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- main.py:257-260 (registration)Registration of the 'list_ingredients' tool using @mcp.tool decorator.
@mcp.tool( name="list_ingredients", description="Returns a list of ingredients based on a simple style.", ) - main.py:261-268 (handler)Handler function that implements the logic for listing ingredients based on style, returning lists of strings.
async def list_ingredients(style: str = "basics") -> List[str]: """Retourne une liste d'ingrédients selon un style simple.""" if style == "basics": return default_ingredients() if style == "fridge": return ["oeufs", "fromage râpé", "lait", "beurre", "restes de légumes", "riz"] return ["pain", "tomate", "mozzarella", "basilic", "huile d'olive"] - main.py:62-77 (helper)Helper resource function 'default_ingredients' called by the handler when style='basics', providing a default list of ingredients.
@mcp.resource( "recipes://ingredients/default", description="Default ingredients list.", ) def default_ingredients() -> List[str]: """Liste d'ingrédients par défaut.""" return [ "pâtes", "tomates concassées", "ail", "oignon", "huile d'olive", "sel", "poivre", ]