set_price_alert
Monitor product prices and receive notifications when they drop to your target price. Track items by name or barcode across supermarkets to save money on purchases.
Instructions
Set a personalized price alert for a product.
Get notified when a product reaches your target price!
Features:
Monitor any product by name or barcode
Set your desired price target
Automatic price checking across all supermarkets
Get alerts when price drops below your target
Perfect for:
Waiting for sales on expensive items
Tracking price drops
Budget-conscious shopping
Never missing a good deal
Example: "Alert me when Coca Cola 2.25L drops below $800"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productName | Yes | Product name to monitor (e.g., "Coca Cola 2.25L", "Arroz integral") | |
| targetPrice | Yes | Target price in pesos - alert when product reaches or goes below this price | |
| barcode | No | Optional barcode/EAN for exact product matching | |
| userId | No | Optional user ID to associate this alert with | |
| notifyEnabled | No | Enable push notifications when alert triggers (default: true) |
Implementation Reference
- src/tools/setPriceAlert.ts:56-113 (handler)The main handler function that executes the set_price_alert tool logic: calls the API to create a price alert, handles success/error, and formats a detailed response with alert info.export async function executeSetPriceAlert( client: SuperPrecioApiClient, args: { productName: string; targetPrice: number; barcode?: string; userId?: number; notifyEnabled?: boolean; } ) { const response = await client.createPriceAlert(args); if (!response.success) { return { content: [ { type: 'text', text: `Failed to create price alert: ${response.message || 'Unknown error'}`, }, ], isError: true, }; } const alert = response.data; const summary = ` 🔔 Price Alert Created Successfully! 📦 Product: ${alert.productName} ${alert.barcode ? `🏷️ Barcode: ${alert.barcode}` : ''} 🎯 Target Price: $${alert.targetPrice.toLocaleString('es-AR')} 🆔 Alert ID: ${alert.id} ${alert.notifyEnabled ? '✅ Notifications: Enabled' : '🔕 Notifications: Disabled'} 📅 Created: ${new Date(alert.createdAt).toLocaleDateString('es-AR')} What happens now: 1. We'll search for this product across all supermarkets 2. When the price drops to $${alert.targetPrice} or below, you'll be notified 3. Use get_my_alerts to check the status anytime 4. Use remove_price_alert to cancel this alert 💡 Tip: Run check_alert_status periodically to see current prices! `; return { content: [ { type: 'text', text: summary, }, { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/tools/setPriceAlert.ts:7-54 (schema)Defines the tool metadata including name 'set_price_alert', description, and inputSchema for parameter validation (productName, targetPrice required; barcode, userId, notifyEnabled optional).export const setPriceAlertTool = { name: 'set_price_alert', description: `Set a personalized price alert for a product. Get notified when a product reaches your target price! Features: - Monitor any product by name or barcode - Set your desired price target - Automatic price checking across all supermarkets - Get alerts when price drops below your target Perfect for: - Waiting for sales on expensive items - Tracking price drops - Budget-conscious shopping - Never missing a good deal Example: "Alert me when Coca Cola 2.25L drops below $800"`, inputSchema: { type: 'object', properties: { productName: { type: 'string', description: 'Product name to monitor (e.g., "Coca Cola 2.25L", "Arroz integral")', }, targetPrice: { type: 'number', description: 'Target price in pesos - alert when product reaches or goes below this price', minimum: 0.01, }, barcode: { type: 'string', description: 'Optional barcode/EAN for exact product matching', }, userId: { type: 'number', description: 'Optional user ID to associate this alert with', }, notifyEnabled: { type: 'boolean', description: 'Enable push notifications when alert triggers (default: true)', default: true, }, }, required: ['productName', 'targetPrice'], }, };
- src/index.ts:160-161 (registration)Registers the tool handler in the MCP server's CallToolRequestSchema switch statement, dispatching calls to executeSetPriceAlert.case 'set_price_alert': return await executeSetPriceAlert(apiClient, args as any);
- src/index.ts:108-108 (registration)Includes setPriceAlertTool in the list of available tools returned by ListToolsRequestSchema.setPriceAlertTool,
- src/index.ts:44-44 (registration)Imports the tool definition and handler from the implementation file.import { setPriceAlertTool, executeSetPriceAlert } from './tools/setPriceAlert.js';