removePriceAlert.ts•1.27 kB
/**
* MCP Tool: Remove Price Alert
* Delete a price alert
*/
import type { SuperPrecioApiClient } from '../client/superPrecioApi.js';
export const removePriceAlertTool = {
name: 'remove_price_alert',
description: `Delete a price alert.
Stop monitoring a product's price.
This permanently removes the alert.`,
inputSchema: {
type: 'object',
properties: {
alertId: {
type: 'number',
description: 'ID of the price alert to delete',
},
},
required: ['alertId'],
},
};
export async function executeRemovePriceAlert(
client: SuperPrecioApiClient,
args: { alertId: number }
) {
const response = await client.deletePriceAlert(args.alertId);
if (!response.success) {
return {
content: [
{
type: 'text',
text: `Failed to delete price alert: ${response.message || 'Unknown error'}`,
},
],
isError: true,
};
}
return {
content: [
{
type: 'text',
text: `
✅ Price alert deleted successfully!
Alert ID ${args.alertId} has been removed and you will no longer receive notifications for this product.
You can:
- View remaining alerts with get_my_alerts
- Create a new alert with set_price_alert
`,
},
],
};
}