removeShoppingList.ts•1.31 kB
/**
* MCP Tool: Remove Shopping List
* Delete a shopping list (soft delete)
*/
import type { SuperPrecioApiClient } from '../client/superPrecioApi.js';
export const removeShoppingListTool = {
name: 'remove_shopping_list',
description: `Delete a shopping list.
This removes the list and all its items from the active lists.
The list is soft-deleted (marked as inactive) so it can be recovered if needed.`,
inputSchema: {
type: 'object',
properties: {
listId: {
type: 'number',
description: 'ID of the shopping list to delete',
},
},
required: ['listId'],
},
};
export async function executeRemoveShoppingList(
client: SuperPrecioApiClient,
args: { listId: number }
) {
const response = await client.deleteShoppingList(args.listId);
if (!response.success) {
return {
content: [
{
type: 'text',
text: `Failed to delete shopping list: ${response.message || 'Unknown error'}`,
},
],
isError: true,
};
}
return {
content: [
{
type: 'text',
text: `
✅ Shopping list deleted successfully!
List ID ${args.listId} has been removed.
You can:
- View remaining lists with get_shopping_lists
- Create a new list with create_shopping_list
`,
},
],
};
}