feat(mcp): add reference_time parameter to add_memory tool#1377
Open
daniel-rudaev wants to merge 1 commit intogetzep:mainfrom
Open
feat(mcp): add reference_time parameter to add_memory tool#1377daniel-rudaev wants to merge 1 commit intogetzep:mainfrom
daniel-rudaev wants to merge 1 commit intogetzep:mainfrom
Conversation
Member
|
All contributors have signed the CLA ✍️ ✅ |
The add_memory MCP tool currently hardcodes reference_time to datetime.now(UTC) in the queue service, even though the underlying Graphiti.add_episode() fully supports it. This means all ingested episodes get the current timestamp regardless of when the content actually occurred, breaking temporal reasoning for historical data. Changes: - Add optional reference_time (ISO 8601 string) param to add_memory tool - Parse and pass through to QueueService.add_episode() - QueueService passes to Graphiti.add_episode() instead of hardcoding now() - Falls back to datetime.now(UTC) when not provided (preserving existing behavior)
e0ce0d8 to
36166a9
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
danielchalef
added a commit
that referenced
this pull request
Apr 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
add_memoryMCP tool currently hardcodesreference_timetodatetime.now(UTC)in the queue service, even though the underlyingGraphiti.add_episode()fully supports it. This means all ingested episodes get the current timestamp regardless of when the content actually occurred, breaking temporal reasoning for historical data.Use case: When ingesting conversation exports (e.g., ChatGPT, Gmail) spanning years, each episode should carry its original date so Graphiti can correctly:
valid_aton extracted facts to reflect when events actually happenedChanges
reference_time(ISO 8601 string) parameter toadd_memorytoolQueueService.add_episode()QueueServicepasses toGraphiti.add_episode()instead of hardcodingdatetime.now()datetime.now(UTC)when not provided (preserving existing behavior)Files changed
mcp_server/src/graphiti_mcp_server.py— add param to tool signature + docstring, parse ISO 8601, forward to queue servicemcp_server/src/services/queue_service.py— accept + forwardreference_time, log itTest plan
add_memorywithoutreference_timestill works (defaults to now)add_memorywithreference_time="2023-06-15T12:00:00Z"setsvalid_aton extracted facts to ~2023-06-15reference_timestring logs a warning and falls back to nowreference_time🤖 Generated with Claude Code