Skip to content

feat: add memory_health diagnostic tool to core MCP profile - #95

Open
AhmedHamadto wants to merge 1 commit into
neo4j-labs:mainfrom
AhmedHamadto:feat/memory-health
Open

feat: add memory_health diagnostic tool to core MCP profile#95
AhmedHamadto wants to merge 1 commit into
neo4j-labs:mainfrom
AhmedHamadto:feat/memory-health

Conversation

@AhmedHamadto

Copy link
Copy Markdown
Contributor

Summary

Adds a memory_health tool 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 accurate
  • test_health_detects_orphaned_facts — facts without ABOUT are flagged
  • test_health_detects_linked_facts — linked facts don't count as orphaned

Health query verified against a live Neo4j graph with 28 entities, 26 facts, 17 preferences — all counts accurate.

Fixes #91

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
@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

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.

@vercel

vercel Bot commented Apr 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-memory Ready Ready Preview, Comment Apr 23, 2026 0:52am

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.

Enhancement: add memory_health diagnostic tool to MCP server

1 participant