From dc874415b4e51bac9a5e9fe0bd2eddc5a0a57332 Mon Sep 17 00:00:00 2001 From: Moritz Graf Date: Tue, 15 Sep 2026 22:14:18 +0200 Subject: [PATCH] fix(bring): properly extract items from BringItemsResponse --- skills/shopping/scripts/bring_mcp.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/skills/shopping/scripts/bring_mcp.py b/skills/shopping/scripts/bring_mcp.py index baeeba8..1fefdd0 100755 --- a/skills/shopping/scripts/bring_mcp.py +++ b/skills/shopping/scripts/bring_mcp.py @@ -137,20 +137,28 @@ class BringClientManager: list_uuid, canonical_name = await self.resolve_list(list_name) list_details = await client.get_list(list_uuid) + items_container = getattr(list_details, "items", list_details) + raw_purchase = getattr(items_container, "purchase", []) or [] + raw_recently = getattr(items_container, "recently", []) or [] + # Purchase items (active to-buy) purchase_items = [] - for item in getattr(list_details, "purchase", []): + for item in raw_purchase: + name = getattr(item, "itemId", getattr(item, "name", str(item))) + spec = getattr(item, "specification", "") or "" purchase_items.append({ - "name": getattr(item, "name", item.get("name") if isinstance(item, dict) else str(item)), - "specification": getattr(item, "specification", item.get("specification", "") if isinstance(item, dict) else ""), + "name": name, + "specification": spec or None, }) # Recently bought items recently_items = [] - for item in getattr(list_details, "recently", []): + for item in raw_recently: + name = getattr(item, "itemId", getattr(item, "name", str(item))) + spec = getattr(item, "specification", "") or "" recently_items.append({ - "name": getattr(item, "name", item.get("name") if isinstance(item, dict) else str(item)), - "specification": getattr(item, "specification", item.get("specification", "") if isinstance(item, dict) else ""), + "name": name, + "specification": spec or None, }) return {