get_recipe_by_index
Retrieve a specific Christmas recipe using its numerical index to access culinary content from recipe databases.
Instructions
Retrieves a Christmas recipe by its index (1-based).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"index": "<index>"
},
"name": "get_recipe_by_index"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- main.py:369-374 (handler)The asynchronous handler function that implements the logic for retrieving a specific Christmas recipe by its 1-based index from the predefined list, returning the recipe as a dictionary or an error if index is invalid.
async def get_recipe_by_index(index: int) -> Dict: """Récupère une recette de Noël par son index (1-based).""" recipes = christmas_recipes() if 1 <= index <= len(recipes): return recipes[index - 1].model_dump() return {"error": "Index de recette invalide."} - main.py:365-368 (registration)The @mcp.tool decorator that registers the get_recipe_by_index tool with its name and description.
@mcp.tool( name="get_recipe_by_index", description="Retrieves a Christmas recipe by its index (1-based).", )