Skip to main content
Glama

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
NameRequiredDescriptionDefault
list_idYesThe list ID returned by create_list.

Implementation Reference

  • 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.`, }, ], }; },
  • 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.`, }, ], }; }, );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jrandolf/par5-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server