get_shelf_cocktails
Find cocktails you can make with ingredients currently available on your bar shelf. Use this tool to discover drink recipes based on what you have in stock.
Instructions
Get all cocktails you can make with ingredients on your bar shelf
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bar_id | No | Bar ID (optional if BAR_ASSISTANT_BAR_ID is set) | |
| page | No | Page number for pagination (optional) |
Implementation Reference
- src/bar_assistant_mcp/server.py:272-298 (handler)Handler implementation for the 'get_shelf_cocktails' tool. Fetches cocktails makeable with bar shelf ingredients from the API, handles pagination and bar_id, formats the response as text.elif name == "get_shelf_cocktails": 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." )] params = {} if arguments.get("page"): params["page"] = arguments["page"] response = await client.get( f"{CONFIG['api_url']}/bars/{int(bar_id)}/cocktails", headers=get_headers(bar_id), params=params ) response.raise_for_status() data = response.json() result = f"You can make {len(data.get('data', []))} cocktails:\n\n" for cocktail in data.get('data', []): result += f"**{cocktail['name']}** (ID: {cocktail['id']})\n" if cocktail.get('short_ingredients'): result += f" • {', '.join(cocktail['short_ingredients'])}\n" return [TextContent(type="text", text=result)]
- src/bar_assistant_mcp/server.py:150-166 (registration)Registration of the 'get_shelf_cocktails' tool in list_tools(), including its name, description, and input schema.Tool( name="get_shelf_cocktails", description="Get all cocktails you can make with ingredients on your bar shelf", inputSchema={ "type": "object", "properties": { "bar_id": { "type": "number", "description": "Bar ID (optional if BAR_ASSISTANT_BAR_ID is set)" }, "page": { "type": "number", "description": "Page number for pagination (optional)" } } } ),