memory_merge
Combine two memories into one by merging content and metadata from a source memory into a target memory, then deleting the source.
Instructions
Merge source memory into target, then delete source.
Combines two memories into one, preserving content and metadata.
Args: source_id: Memory ID to merge from (will be deleted) target_id: Memory ID to merge into (will be updated) merge_strategy: How to combine content: - "append": Append source content to target (default) - "prepend": Prepend source content to target - "replace": Replace target content with source
Returns: Updated target memory and deletion confirmation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_id | Yes | ||
| target_id | Yes | ||
| merge_strategy | No | append |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- memora/graph/server.py:83-111 (handler)The backend Python server handles MCP-like tool execution for the graph visualization component, including 'create_memory', 'update_memory', and 'delete_memory'.
def _execute_chat_tool(tool_name: str, arguments: dict) -> str: """Execute a chat tool call and return result as JSON string.""" conn = connect() try: if tool_name == "create_memory": result = add_memory(conn, content=arguments["content"], tags=arguments.get("tags")) return json.dumps({"success": True, "action": "created", "memory_id": result["id"], "preview": result["content"][:100]}) elif tool_name == "update_memory": mid = arguments["memory_id"] result = update_memory(conn, mid, content=arguments.get("content"), tags=arguments.get("tags")) if result is None: return json.dumps({"success": False, "error": f"Memory #{mid} not found."}) return json.dumps({"success": True, "action": "updated", "memory_id": mid, "preview": result["content"][:100]}) elif tool_name == "delete_memory": mid = arguments["memory_id"] existing = get_memory(conn, mid) if not existing: return json.dumps({"success": False, "error": f"Memory #{mid} not found."}) delete_memory(conn, mid) return json.dumps({"success": True, "action": "deleted", "memory_id": mid, "preview": existing["content"][:100]}) return json.dumps({"success": False, "error": f"Unknown tool: {tool_name}"}) except Exception as e: return json.dumps({"success": False, "error": str(e)[:200]}) finally: conn.close()