agentbay_memory_store
Store memories with a full write pipeline: poison detection, dedup, embedding, persist. Control lifetime by setting memory tier (working, episodic, semantic, procedural).
Instructions
Store a memory with full write pipeline: poison detection, dedup, embedding, persist. Set tier to control lifetime.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| title | Yes | Short descriptive title | |
| content | Yes | Full content of the memory | |
| type | Yes | ||
| tier | No | Memory tier (default: semantic) | |
| tags | No | ||
| aliases | No | Search phrases that should map to this entry | |
| confidence | No | ||
| source | No | Who created this | |
| sourceAgent | No | Agent name that created this memory | |
| ttlHours | No | Override TTL for working-tier (default 24h) | |
| filePaths | No |
Implementation Reference
- src/index.ts:654-685 (registration)Registration of the 'agentbay_memory_store' tool on the MCP server via server.tool()
server.tool( 'agentbay_memory_store', 'Store a memory with full write pipeline: poison detection, dedup, embedding, persist. Set tier to control lifetime.', { projectId: z.string().describe('Project ID'), title: z.string().describe('Short descriptive title'), content: z.string().describe('Full content of the memory'), type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), tier: z.enum(['working', 'episodic', 'semantic', 'procedural']).optional().describe('Memory tier (default: semantic)'), tags: z.array(z.string()).optional(), aliases: z.array(z.string()).optional().describe('Search phrases that should map to this entry'), confidence: z.number().min(0).max(1).optional(), source: z.string().optional().describe('Who created this'), sourceAgent: z.string().optional().describe('Agent name that created this memory'), ttlHours: z.number().optional().describe('Override TTL for working-tier (default 24h)'), filePaths: z.array(z.string()).optional(), }, async ({ projectId, title, content, type, tier, tags, aliases, confidence, source, sourceAgent, ttlHours, filePaths }) => { const data = await apiPost(`/api/v1/projects/${projectId}/memory`, { title, content, type, tier, tags, aliases, confidence, source, sourceAgent, ttlHours, filePaths, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; if (data.poisonBlocked) return { content: [{ type: 'text' as const, text: `Blocked: Content failed poison detection.` }] }; let text = data.deduplicated ? `Updated existing memory: ${data.id} (deduplication matched)` : `Stored new memory: ${data.id}`; text += ` | ${data.tokenCount} tokens`; if (data.conflictIds?.length) text += `\nPotential conflicts with: ${data.conflictIds.join(', ')}`; return { content: [{ type: 'text' as const, text }] }; } ); - src/index.ts:657-670 (schema)Zod schema defining all input parameters for agentbay_memory_store: projectId, title, content, type, tier, tags, aliases, confidence, source, sourceAgent, ttlHours, filePaths
{ projectId: z.string().describe('Project ID'), title: z.string().describe('Short descriptive title'), content: z.string().describe('Full content of the memory'), type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), tier: z.enum(['working', 'episodic', 'semantic', 'procedural']).optional().describe('Memory tier (default: semantic)'), tags: z.array(z.string()).optional(), aliases: z.array(z.string()).optional().describe('Search phrases that should map to this entry'), confidence: z.number().min(0).max(1).optional(), source: z.string().optional().describe('Who created this'), sourceAgent: z.string().optional().describe('Agent name that created this memory'), ttlHours: z.number().optional().describe('Override TTL for working-tier (default 24h)'), filePaths: z.array(z.string()).optional(), }, - src/index.ts:671-685 (handler)Handler function that POSTs to /api/v1/projects/{projectId}/memory and returns result (dedup, poison detection, token count, conflicts)
async ({ projectId, title, content, type, tier, tags, aliases, confidence, source, sourceAgent, ttlHours, filePaths }) => { const data = await apiPost(`/api/v1/projects/${projectId}/memory`, { title, content, type, tier, tags, aliases, confidence, source, sourceAgent, ttlHours, filePaths, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; if (data.poisonBlocked) return { content: [{ type: 'text' as const, text: `Blocked: Content failed poison detection.` }] }; let text = data.deduplicated ? `Updated existing memory: ${data.id} (deduplication matched)` : `Stored new memory: ${data.id}`; text += ` | ${data.tokenCount} tokens`; if (data.conflictIds?.length) text += `\nPotential conflicts with: ${data.conflictIds.join(', ')}`; return { content: [{ type: 'text' as const, text }] }; } );