add_ingredients_to_shelf
Add ingredients to your bar shelf by their IDs to manage your home bar inventory and discover cocktails you can make.
Instructions
Add ingredients to your bar shelf by their IDs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ingredient_ids | Yes | Array of ingredient IDs to add to shelf | |
| bar_id | No | Bar ID (optional if BAR_ASSISTANT_BAR_ID is set) |
Implementation Reference
- src/bar_assistant_mcp/server.py:300-321 (handler)The execution logic for the 'add_ingredients_to_shelf' tool. Extracts bar_id and ingredient_ids, sends a POST request to batch-add ingredients to the bar shelf via the API, and returns a success message.elif name == "add_ingredients_to_shelf": bar_id = arguments.get("bar_id") or CONFIG["bar_id"] if not bar_id: return [TextContent( type="text", text="Error: No bar ID provided. Use list_bars to find your bar ID or set BAR_ASSISTANT_BAR_ID." )] ingredient_ids = [int(id) for id in arguments["ingredient_ids"]] response = await client.post( f"{CONFIG['api_url']}/bars/{int(bar_id)}/ingredients/batch-store", headers=get_headers(bar_id), json={"ingredients": ingredient_ids} ) response.raise_for_status() return [TextContent( type="text", text=f"Successfully added {len(ingredient_ids)} ingredients to your bar shelf!" )]
- src/bar_assistant_mcp/server.py:167-185 (registration)Registration of the 'add_ingredients_to_shelf' tool in the list_tools() function, including its name, description, and input schema definition.Tool( name="add_ingredients_to_shelf", description="Add ingredients to your bar shelf by their IDs", inputSchema={ "type": "object", "properties": { "ingredient_ids": { "type": "array", "items": {"type": "number"}, "description": "Array of ingredient IDs to add to shelf" }, "bar_id": { "type": "number", "description": "Bar ID (optional if BAR_ASSISTANT_BAR_ID is set)" } }, "required": ["ingredient_ids"] } ),
- Input schema for the 'add_ingredients_to_shelf' tool, defining required ingredient_ids array and optional bar_id.inputSchema={ "type": "object", "properties": { "ingredient_ids": { "type": "array", "items": {"type": "number"}, "description": "Array of ingredient IDs to add to shelf" }, "bar_id": { "type": "number", "description": "Bar ID (optional if BAR_ASSISTANT_BAR_ID is set)" } }, "required": ["ingredient_ids"] } ),