Skip to content

Comments

Fix #3137: Memory MCP open_nodes returns empty relations array despit#3375

Open
danielalanbates wants to merge 1 commit intomodelcontextprotocol:mainfrom
danielalanbates:fix/issue-3137
Open

Fix #3137: Memory MCP open_nodes returns empty relations array despit#3375
danielalanbates wants to merge 1 commit intomodelcontextprotocol:mainfrom
danielalanbates:fix/issue-3137

Conversation

@danielalanbates
Copy link

Fixes #3137

Summary

This PR fixes: Memory MCP open_nodes returns empty relations array despite entity having relations in graph

Changes

src/memory/__tests__/knowledge-graph.test.ts | 18 ++++++++++++------
 src/memory/index.ts                          | 17 +++++++++--------
 2 files changed, 21 insertions(+), 14 deletions(-)

Testing

Please review the changes carefully. The fix was verified against the existing test suite.


This PR was created with the assistance of Claude Haiku 4.5 by Anthropic | effort: low. Happy to make any adjustments!

By submitting this pull request, I confirm that my contribution is made under the terms of the project's license (contributor license agreement).

…s in openNodes results

The openNodes method was only returning relations where both endpoints were in
the requested entity set (using &&). This prevented graph traversal from specific
nodes without fetching the entire graph.

Changed the filter logic to use || instead of &&, so openNodes now returns:
- Outgoing relations (where the entity is the source)
- Incoming relations (where the entity is the destination)

This matches standard graph database behavior and enables efficient graph
traversal by returning all edges connected to queried nodes.

Updated tests to reflect the new expected behavior where openNodes returns all
connected relations for the requested entities.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.

Memory MCP open_nodes returns empty relations array despite entity having relations in graph

1 participant