Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

feat: expose infer param in MCP add_memories tool (#4517)

Utkarsh924ac00c5261
diff --git a/openmemory/api/app/mcp_server.py b/openmemory/api/app/mcp_server.py
index 3fcacc4aa..11497261b 100644
--- a/openmemory/api/app/mcp_server.py
+++ b/openmemory/api/app/mcp_server.py
@@ -57,8 +57,8 @@ mcp_router = APIRouter(prefix="/mcp")
# Initialize SSE transport
sse = SseServerTransport("/mcp/messages/")
[email protected](description="Add a new memory. This method is called everytime the user informs anything about themselves, their preferences, or anything that has any relevant information which can be useful in the future conversation. This can also be called when the user asks you to remember something.")
-async def add_memories(text: str) -> str:
[email protected](description="Add a new memory. This method is called everytime the user informs anything about themselves, their preferences, or anything that has any relevant information which can be useful in the future conversation. This can also be called when the user asks you to remember something. Set infer to False to store the memory verbatim without LLM fact extraction.")
+async def add_memories(text: str, infer: bool = True) -> str:
uid = user_id_var.get(None)
client_name = client_name_var.get(None)
@@ -87,7 +87,8 @@ async def add_memories(text: str) -> str:
metadata={
"source_app": "openmemory",
"mcp_client": client_name,
- })
+ },
+ infer=infer)
# Process the response and update database
if isinstance(response, dict) and 'results' in response: