createMemoryVaultTool
createMemoryVaultTool(
vaultCtx:VaultMemoryOperationsContext,options?:MemoryVaultToolOptions,embeddingOptions?:MemoryEngineEmbeddingOptions,cache?:VaultEmbeddingCache):ToolConfig
Defined in: src/lib/memoryVault/tool.ts:86
Creates a memory vault tool for use with chat completions.
The tool allows the LLM to save and update persistent memories. Each operation can be intercepted for user confirmation before committing.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
Vault operations context for database access | |
|
|
Optional configuration (onSave callback for confirmation) | |
|
|
‐ | |
|
|
‐ |
Returns
ToolConfig
A ToolConfig that can be passed to chat completion tools
Example
const tool = createMemoryVaultTool(vaultCtx, {
onSave: async (op) => {
// Show confirmation toast, return true/false
return await showConfirmationToast(op);
},
});
await sendMessage({
messages: [...],
clientTools: [tool],
});Last updated on