get_shelf_ingredients
Retrieve all ingredients currently available on your bar shelf with detailed information for inventory management and cocktail preparation.
Instructions
Get all ingredients currently on your bar shelf with detailed information
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:246-271 (handler)Handler logic for the 'get_shelf_ingredients' tool. Fetches ingredients on the bar shelf from the API, handles pagination and bar_id, formats the response as text listing ingredients.if name == "get_shelf_ingredients": 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 = {"filter[bar_shelf]": "true"} if arguments.get("page"): params["page"] = arguments["page"] response = await client.get( f"{CONFIG['api_url']}/ingredients", headers=get_headers(bar_id), params=params ) response.raise_for_status() data = response.json() return [TextContent( type="text", text=f"Found {len(data.get('data', []))} ingredients on your bar shelf:\n\n" + "\n".join([f"- {ing['name']} (ID: {ing['id']})" for ing in data.get('data', [])]) )]
- src/bar_assistant_mcp/server.py:133-149 (registration)Tool registration in list_tools() function, defining the name, description, and input schema for 'get_shelf_ingredients'.Tool( name="get_shelf_ingredients", description="Get all ingredients currently on your bar shelf with detailed information", 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)" } } } ),
- Input schema definition for the 'get_shelf_ingredients' tool, specifying optional bar_id and page parameters.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)" } } }