Skip to main content
Glama

delete_passage

Remove specific memories from an agent's archival storage permanently. Use to manage memory by deleting identified passages with agent and memory IDs.

Instructions

Delete a memory from an agent's archival memory store. Use list_passages to find memory IDs. WARNING: This action is permanent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesID of the agent whose passage to delete
memory_idYesID of the passage (memory) to delete

Implementation Reference

  • The handler function that implements the logic for the delete_passage tool by calling the API to delete a memory passage.
    export async function handleDeletePassage(server, args) {
        if (!args?.agent_id) {
            server.createErrorResponse('Missing required argument: agent_id');
        }
        if (!args?.memory_id) {
            server.createErrorResponse('Missing required argument: memory_id');
        }
    
        try {
            const headers = server.getApiHeaders();
            const agentId = encodeURIComponent(args.agent_id);
            const memoryId = encodeURIComponent(args.memory_id);
    
            // Use the specific endpoint from the OpenAPI spec
            await server.api.delete(`/agents/${agentId}/archival-memory/${memoryId}`, { headers });
    
            // Successful deletion usually returns 200 or 204 with no body
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            memory_id: args.memory_id,
                            agent_id: args.agent_id,
                        }),
                    },
                ],
            };
        } catch (error) {
            // Handle potential 404 if agent or passage not found, or other API errors
            if (error.response && error.response.status === 404) {
                server.createErrorResponse(
                    `Agent or Passage not found: agent_id=${args.agent_id}, memory_id=${args.memory_id}`,
                );
            }
            server.createErrorResponse(error);
        }
    }
  • The tool definition including name, description, and input schema for delete_passage.
    export const deletePassageDefinition = {
        name: 'delete_passage',
        description:
            "Delete a memory from an agent's archival memory store. Use list_passages to find memory IDs. WARNING: This action is permanent.",
        inputSchema: {
            type: 'object',
            properties: {
                agent_id: {
                    type: 'string',
                    description: 'ID of the agent whose passage to delete',
                },
                memory_id: {
                    type: 'string',
                    description: 'ID of the passage (memory) to delete',
                },
            },
            required: ['agent_id', 'memory_id'],
        },
    };
  • Registration of the delete_passage handler in the main tool dispatch switch statement.
    case 'delete_passage':
        return handleDeletePassage(server, request.params.arguments);
  • Inclusion of deletePassageDefinition in the list of all tool definitions for registration.
    deletePassageDefinition,
  • Import of the handler and definition for delete_passage.
    import { handleDeletePassage, deletePassageDefinition } from './passages/delete-passage.js';

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