suggest_bundle
Generate product bundle recommendations based on frequently purchased together items and complementary art supplies to help customers discover relevant combinations.
Instructions
Suggest product bundles based on frequently bought together items or complementary products.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseSku | Yes | Base product SKU to build bundle around |
Implementation Reference
- src/index.ts:1004-1027 (handler)The handler function for the 'suggest_bundle' tool. It retrieves the base product by SKU, finds up to 3 complementary products from the same category, calculates the total bundle price with a 15% discount, and returns a formatted suggestion text.case 'suggest_bundle': { const baseSku = String(args?.baseSku || ''); const baseItem = storeData.inventory.find(i => i.id === baseSku); if (!baseItem) { return { content: [{ type: 'text', text: `❌ Product ${baseSku} not found` }] }; } const complementary = storeData.inventory .filter(i => i.category === baseItem.category || i.id !== baseSku) .slice(0, 3); const bundlePrice = baseItem.price + complementary.reduce((sum, item) => sum + item.price, 0); const bundleDiscount = bundlePrice * 0.15; return { content: [{ type: 'text', text: `🎁 Suggested Bundle:\n\n📦 Base Item:\n• ${baseItem.name} - $${baseItem.price}\n\n➕ Add to Bundle:\n${complementary.map(item => `• ${item.name} - $${item.price}` ).join('\n')}\n\n💰 Bundle Price:\n- Individual Total: $${bundlePrice.toFixed(2)}\n- Bundle Discount (15%): -$${bundleDiscount.toFixed(2)}\n- Bundle Price: $${(bundlePrice - bundleDiscount).toFixed(2)}\n💵 Customer Saves: $${bundleDiscount.toFixed(2)}` }] }; }
- src/index.ts:313-322 (schema)The tool definition including name, description, and input schema for 'suggest_bundle'. This is part of the tools array registered for listing available tools.name: 'suggest_bundle', description: 'Suggest product bundles based on frequently bought together items or complementary products.', inputSchema: { type: 'object', properties: { baseSku: { type: 'string', description: 'Base product SKU to build bundle around' }, }, required: ['baseSku'], }, },
- src/index.ts:516-518 (registration)Registers the handler for ListToolsRequestSchema which returns the full list of tools, including 'suggest_bundle'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });