Skip to content

feat: expose infer param in MCP add_memories tool#4517

Merged
whysosaket merged 1 commit intomainfrom
fix/mcp-add-infer-param
Mar 25, 2026
Merged

feat: expose infer param in MCP add_memories tool#4517
whysosaket merged 1 commit intomainfrom
fix/mcp-add-infer-param

Conversation

@utkarsh240799
Copy link
Copy Markdown
Contributor

Linked Issue

Closes #3322

Description

The MCP server's add_memories tool always used infer=True when calling memory_client.add(), with no way for MCP clients to control LLM fact extraction. This caused memories about third parties to lose their subject (e.g., "Bob has a PhD" → "has a PhD"), making them unusable.

This adds an infer parameter (default True) to the MCP add_memories tool and passes it through to memory_client.add(). This brings the MCP API to parity with the REST API (which already supports infer since #3607). The tool description is also updated to document the parameter for MCP clients.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (no functional changes)
  • Documentation update

Breaking Changes

N/A

Test Coverage

  • I added/updated unit tests
  • I added/updated integration tests
  • I tested manually (describe below)
  • No tests needed (explain why)

Verified that the infer parameter is accepted in the function signature and correctly forwarded to memory_client.add(). The change is minimal (3 lines) and mirrors the existing REST API behavior.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation if needed

Allow MCP clients to control LLM fact extraction by passing infer=False
to store memories verbatim. Defaults to True for backward compatibility.
Brings MCP API to parity with the REST API.

Closes #3322

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@whysosaket whysosaket merged commit 924ac00 into main Mar 25, 2026
3 checks passed
@kartik-mem0 kartik-mem0 deleted the fix/mcp-add-infer-param branch March 25, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Openmemory changes memories before they hit the vector store

3 participants