Remove items from a list
remove_itemsRemove specific items from a Cozi list by providing the list ID and item IDs, keeping your shopping or to-do list organized.
Instructions
Remove items from a list. Returns true on success.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ||
| item_ids | Yes |
Implementation Reference
- src/tools/items.ts:37-43 (handler)Handler function for the remove_items tool. Delegates to CoziClient.removeItems() and returns a boolean indicating success.
export async function removeItemsHandler( client: CoziClient, listId: string, itemIds: string[], ): Promise<boolean> { return client.removeItems(listId, itemIds); } - src/tools/items.ts:92-92 (schema)Input schema for remove_items: expects list_id (string) and item_ids (array of strings).
inputSchema: { list_id: z.string(), item_ids: z.array(z.string()) }, - src/tools/items.ts:87-98 (registration)Registration of remove_items tool via server.registerTool(), called from registerItemTools().
server.registerTool( 'remove_items', { title: 'Remove items from a list', description: 'Remove items from a list. Returns true on success.', inputSchema: { list_id: z.string(), item_ids: z.array(z.string()) }, }, async ({ list_id, item_ids }) => { const result = await removeItemsHandler(await getClient(), list_id, item_ids); return { content: [{ type: 'text', text: JSON.stringify(result) }] }; }, ); - src/cozi/client.ts:182-192 (helper)Client-level implementation: sends a PATCH request to the list endpoint with remove operations for each item ID. Returns early true for empty array.
async removeItems(listId: string, itemIds: string[]): Promise<boolean> { if (itemIds.length === 0) return true; await this.ensureAuthenticated(); const operations = itemIds.map((id) => ({ op: 'remove', path: `/items/${id}` })); await this.http.request({ method: 'PATCH', endpoint: this.accountEndpoint(`/list/${listId}`), body: { operations }, }); return true; } - src/tools/index.ts:18-31 (registration)TOOL_NAMES constant listing all tool names including 'remove_items'.
export const TOOL_NAMES = [ 'family_members', 'get_lists', 'get_list_items', 'create_list', 'delete_list', 'add_item', 'update_item', 'remove_items', 'get_calendar', 'create_appointment', 'update_appointment', 'delete_appointment', ] as const;