UNPKG

@tomaspavlin/rohlik-mcp

Version:

MCP server for controlling Rohlik.cz grocery shopping website

55 lines 2.05 kB
export function createDeliverySlotsTool(createRohlikAPI) { return { name: "get_delivery_slots", definition: { title: "Get Delivery Slots", description: "Get available delivery time slots for your address", inputSchema: {} }, handler: async () => { try { const api = createRohlikAPI(); const deliverySlots = await api.getDeliverySlots(); if (!deliverySlots) { return { content: [ { type: "text", text: "No delivery slots available." } ] }; } const formatSlots = (data) => { if (Array.isArray(data)) { return `⏰ AVAILABLE DELIVERY SLOTS:\n\n${data.map((slot, index) => `${index + 1}. ${slot.date || 'Unknown date'} ${slot.time || slot.timeRange || 'Unknown time'} Price: ${slot.price || slot.deliveryFee || 'Free'} CZK Available: ${slot.available ? 'Yes' : 'No'}`).join('\n\n')}`; } return `⏰ DELIVERY SLOTS:\n${JSON.stringify(data, null, 2)}`; }; const output = formatSlots(deliverySlots); return { content: [ { type: "text", text: output } ] }; } catch (error) { return { content: [ { type: "text", text: error instanceof Error ? error.message : String(error) } ], isError: true }; } } }; } //# sourceMappingURL=delivery-slots.js.map