feat: add memory_health diagnostic tool to core MCP profile - #95
Open
AhmedHamadto wants to merge 1 commit into
Open
feat: add memory_health diagnostic tool to core MCP profile#95AhmedHamadto wants to merge 1 commit into
AhmedHamadto wants to merge 1 commit into
Conversation
Adds a memory_health tool that returns node counts, relationship counts,
and integrity metrics in one call. Reports orphaned facts (no ABOUT
relationship to any entity), orphaned preferences, and entities without
embeddings.
Example output:
{"nodes": {"entities": 28, "facts": 26, "preferences": 17, ...},
"relationships": {"ABOUT": 22},
"integrity": {"orphaned_facts": 9, "orphaned_preferences": 17,
"entities_without_embedding": 0}}
Fixes neo4j-labs#91
|
Someone is attempting to deploy a commit to the lyonwj's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Adds a
memory_healthtool to the core MCP profile that returns graph integrity metrics in a single call. Reports node counts, relationship counts, and identifies orphaned nodes that have no ABOUT links.Example Output
{ "nodes": { "entities": 28, "facts": 26, "preferences": 17, "messages": 3, "traces": 24 }, "relationships": { "ABOUT": 22 }, "integrity": { "orphaned_facts": 9, "orphaned_preferences": 17, "entities_without_embedding": 0 } }Why This Matters
When entity linking fails silently (#77, #87), orphaned nodes accumulate with no visibility. During a recent audit, we discovered 9 orphaned facts and 17 orphaned preferences — all invisible without manual Cypher queries. This tool makes graph integrity checkable through the standard MCP interface.
Test Plan
3 integration tests in
tests/integration/test_memory_health.py:test_health_returns_node_counts— entity count is accuratetest_health_detects_orphaned_facts— facts without ABOUT are flaggedtest_health_detects_linked_facts— linked facts don't count as orphanedHealth query verified against a live Neo4j graph with 28 entities, 26 facts, 17 preferences — all counts accurate.
Fixes #91