agentbay_memory_forget
Archive or permanently delete specific memory entries within a project. Supports single or batch removal, with hard delete option for permanent erasure.
Instructions
Archive (soft delete) or permanently delete memory entries
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| knowledgeId | No | Single entry ID | |
| knowledgeIds | No | Multiple entry IDs | |
| hardDelete | No | Permanently delete instead of archive (default: false) |
Implementation Reference
- src/index.ts:705-725 (handler)The handler function for 'agentbay_memory_forget'. It accepts projectId, optional knowledgeId (single entry), knowledgeIds (multiple entries), and hardDelete flag. It constructs the request body and calls DELETE /api/v1/projects/{projectId}/memory via the apiDelete helper. Returns the result indicating archive (soft delete) or permanent deletion.
// Tool 22: Memory Forget server.tool( 'agentbay_memory_forget', 'Archive (soft delete) or permanently delete memory entries', { projectId: z.string().describe('Project ID'), knowledgeId: z.string().optional().describe('Single entry ID'), knowledgeIds: z.array(z.string()).optional().describe('Multiple entry IDs'), hardDelete: z.boolean().optional().describe('Permanently delete instead of archive (default: false)'), }, async ({ projectId, knowledgeId, knowledgeIds, hardDelete }) => { const body: Record<string, unknown> = {}; if (knowledgeId) body.knowledgeId = knowledgeId; if (knowledgeIds) body.knowledgeIds = knowledgeIds; if (hardDelete) body.hardDelete = true; const data = await apiDelete(`/api/v1/projects/${projectId}/memory`, body); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: data.deleted ? `Deleted ${data.deleted} entries` : `Archived ${data.archived} entries` }] }; } ); - src/index.ts:706-706 (registration)Registration of the 'agentbay_memory_forget' tool via server.tool() with name 'agentbay_memory_forget'.
server.tool( - src/index.ts:709-714 (schema)Zod schema defining the input parameters: projectId (string), knowledgeId (optional string), knowledgeIds (optional array of strings), hardDelete (optional boolean).
{ projectId: z.string().describe('Project ID'), knowledgeId: z.string().optional().describe('Single entry ID'), knowledgeIds: z.array(z.string()).optional().describe('Multiple entry IDs'), hardDelete: z.boolean().optional().describe('Permanently delete instead of archive (default: false)'), }, - src/index.ts:186-193 (helper)The apiDelete helper function used by the handler to send DELETE requests to the AgentBay API.
async function apiDelete(path: string, body?: unknown) { const res = await fetch(`${API_BASE}${path}`, { method: 'DELETE', headers: getHeaders(), ...(body ? { body: JSON.stringify(body) } : {}), }); return res.json(); }