delete_list
Remove an existing list by its ID to clean up unnecessary data and free up memory after processing is complete.
Instructions
Deletes an existing list by its ID.
WHEN TO USE:
To clean up lists that are no longer needed
To free up memory after processing is complete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The list ID returned by create_list. |
Implementation Reference
- src/index.ts:397-421 (handler)Handler function that implements the delete_list tool logic: validates list existence, deletes the list from the 'lists' Map, and returns success/error messages.async ({ list_id }) => { if (!lists.has(list_id)) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have already been deleted or the ID is incorrect.`, }, ], isError: true, }; } const itemCount = lists.get(list_id)?.length; lists.delete(list_id); return { content: [ { type: "text", text: `Successfully deleted list "${list_id}" which contained ${itemCount} items.`, }, ], }; },
- src/index.ts:387-396 (schema)Tool metadata including description and input schema definition (list_id: string).{ description: `Deletes an existing list by its ID. WHEN TO USE: - To clean up lists that are no longer needed - To free up memory after processing is complete`, inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), }, },
- src/index.ts:385-422 (registration)Registration of the 'delete_list' tool with server.registerTool, including name, schema, and inline handler function.server.registerTool( "delete_list", { description: `Deletes an existing list by its ID. WHEN TO USE: - To clean up lists that are no longer needed - To free up memory after processing is complete`, inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), }, }, async ({ list_id }) => { if (!lists.has(list_id)) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have already been deleted or the ID is incorrect.`, }, ], isError: true, }; } const itemCount = lists.get(list_id)?.length; lists.delete(list_id); return { content: [ { type: "text", text: `Successfully deleted list "${list_id}" which contained ${itemCount} items.`, }, ], }; }, );