From 924ac00c52616f41acae3ec6817fc9f33966534d Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Wed, 25 Mar 2026 15:53:50 +0530 Subject: [PATCH] feat: expose infer param in MCP add_memories tool (#4517) Co-authored-by: utkarsh240799 Co-authored-by: Claude Opus 4.6 (1M context) --- openmemory/api/app/mcp_server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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/") -@mcp.tool(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: +@mcp.tool(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: