Skip to main content
Glama

delete_memory_block

Remove a specific memory block permanently by its ID to manage storage in the Letta system. This action cannot be reversed.

Instructions

Delete a memory block by ID. Use list_memory_blocks to find block IDs. WARNING: This action is permanent and cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYesID of the memory block to delete
agent_idNoOptional agent ID for authorization

Implementation Reference

  • The handler function that validates arguments, sets headers if agent_id provided, deletes the memory block via API, and returns success or error response.
    export async function handleDeleteMemoryBlock(server, args) { try { // Validate arguments if (!args?.block_id) { throw new Error('Missing required argument: block_id'); } // Headers for API requests const headers = server.getApiHeaders(); // If agent_id is provided, set the user_id header if (args.agent_id) { headers['user_id'] = args.agent_id; } // Delete the memory block await server.api.delete(`/blocks/${args.block_id}`, { headers, }); // Return success response return { content: [ { type: 'text', text: JSON.stringify({ success: true, deleted_block_id: args.block_id, }), }, ], }; } catch (error) { return server.createErrorResponse(error); } }
  • The tool definition including name, description, and input schema requiring block_id and optional agent_id.
    export const deleteMemoryBlockToolDefinition = { name: 'delete_memory_block', description: 'Delete a memory block by ID. Use list_memory_blocks to find block IDs. WARNING: This action is permanent and cannot be undone.', inputSchema: { type: 'object', properties: { block_id: { type: 'string', description: 'ID of the memory block to delete', }, agent_id: { type: 'string', description: 'Optional agent ID for authorization', }, }, required: ['block_id'], }, };
  • Import statement registering the handler and tool definition for use in the tools index.
    import { handleDeleteMemoryBlock, deleteMemoryBlockToolDefinition, } from './memory/delete-memory-block.js';
  • Switch case in the tool call handler that dispatches 'delete_memory_block' calls to the specific handler function.
    case 'delete_memory_block': return handleDeleteMemoryBlock(server, request.params.arguments);
  • Inclusion of the tool definition in the allTools array used for listing available tools.
    deleteMemoryBlockToolDefinition,

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/oculairmedia/Letta-MCP-server'

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