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

Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Utkarsh
2026-03-25 15:53:50 +05:30
committed by GitHub
parent 2a36960f4c
commit 924ac00c52
+4 -3
View File
@@ -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: