update_memento
Modify stored memories by updating titles, content, summaries, tags, or importance levels to maintain accurate and current information in your knowledge base.
Instructions
Update an existing memento
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memory_id | Yes | ID of the memory to update | |
| title | No | ||
| content | No | ||
| summary | No | ||
| tags | No | ||
| importance | No |
Implementation Reference
- The handle_update_memento function handles the logic for updating existing memory entries in the database.
@handle_tool_errors("update memory") async def handle_update_memento( memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any] ) -> CallToolResult: """Handle update_memory tool call. Args: memory_db: Database instance for memory operations arguments: Tool arguments from MCP call containing: - memory_id: ID of memory to update (required) - title: New title (optional) - content: New content (optional) - summary: New summary (optional) - tags: New tags list (optional) - importance: New importance score (optional) Returns: CallToolResult with success message or error """ # Validate input arguments validate_memory_input(arguments) memory_id = arguments["memory_id"] # Get existing memory memory = await memory_db.get_memory(memory_id, include_relationships=False) if not memory: return CallToolResult( content=[TextContent(type="text", text=f"Memory not found: {memory_id}")], isError=True, ) # Update fields if "title" in arguments: memory.title = arguments["title"] if "content" in arguments: memory.content = arguments["content"] if "summary" in arguments: memory.summary = arguments["summary"] if "tags" in arguments: memory.tags = arguments["tags"] if "importance" in arguments: memory.importance = arguments["importance"] # Update in database success = await memory_db.update_memory(memory) if success: return CallToolResult( content=[ TextContent( type="text", text=f"Memory updated successfully: {memory_id}" ) ] ) else: return CallToolResult( content=[ TextContent(type="text", text=f"Failed to update memory: {memory_id}") ], isError=True, )