remove_shopping_list
Delete a shopping list and all its items from active lists, with soft-delete functionality allowing recovery if needed.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the shopping list to delete |
Implementation Reference
- src/tools/removeShoppingList.ts:25-59 (handler)Executes the removal of a shopping list by calling the API client's deleteShoppingList method and returns a formatted success or error response.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 `, }, ], }; }
- src/tools/removeShoppingList.ts:7-23 (schema)Defines the tool's metadata: name, description, and input schema requiring a numeric listId.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'], }, };
- src/index.ts:105-105 (registration)Registers the removeShoppingListTool in the array returned by ListToolsRequestSchema, making it discoverable by MCP clients.removeShoppingListTool,
- src/index.ts:156-157 (registration)Registers the dispatch logic in the CallToolRequestSchema handler's switch statement to invoke the tool's execute function.case 'remove_shopping_list': return await executeRemoveShoppingList(apiClient, args as any);
- src/index.ts:41-41 (registration)Imports the tool definition and execution handler from the dedicated tool module.import { removeShoppingListTool, executeRemoveShoppingList } from './tools/removeShoppingList.js';