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
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | ID of the agent whose passage to delete | |
| memory_id | Yes | ID 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'], }, };
- src/tools/index.js:199-200 (registration)Registration of the delete_passage handler in the main tool dispatch switch statement.case 'delete_passage': return handleDeletePassage(server, request.params.arguments);
- src/tools/index.js:127-127 (registration)Inclusion of deletePassageDefinition in the list of all tool definitions for registration.deletePassageDefinition,
- src/tools/index.js:46-46 (registration)Import of the handler and definition for delete_passage.import { handleDeletePassage, deletePassageDefinition } from './passages/delete-passage.js';