feat(memory): add read_graph_summary function for efficient entity overview#2619
feat(memory): add read_graph_summary function for efficient entity overview#2619nhickster wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
…rview without having load the entire knowledge graph
|
This PR addresses the core issue raised in #2415 - that While #2415 proposed implementing a more comprehensive approach, this solution provides an efficient graph index (summary) for the LLM to use. The new This approach:
The result is an efficient "browse then deep-dive" pattern that most LLMs seem to handle pretty well. |
|
Claude Desktop suffers enormously from tokens scarcity. Any plan to use this with a vector database? |
Description
Add
read_graph_summaryfunction to the memory MCP server for efficient entity overview without loading the entire knowledge graph. This new function provides entity names, types, observation counts, and most recent observations while preserving full relation data, significantly reducing context usage for overview scenarios.This allows LLMs to get an overview of the graph in order to make a better decisions about which entities to fully load into the context with
open_nodesServer Details
read_graph_summarytool)Motivation and Context
The existing
read_graphfunction returns complete entity data including all observations, which can become very large and consume significant context space when users only need an overview of their knowledge graph. This creates inefficiency when:The
read_graph_summaryfunction solves this by providing:LLMs can then use the existing
open_nodesfunction to get full details for specific entities of interest.How Has This Been Tested?
Comprehensive testing completed using VSCode with MCP integration:
Functional Testing:
Performance Verification:
read_graph: Returns full 24-observation arrayread_graph_summary: Returns count + last observation onlyIntegration Testing:
read_graph_summary→ identify entities →open_nodesfor detailsEdge Case Testing:
Breaking Changes
No breaking changes - This is a purely additive feature that:
read_graph_summary)Types of changes
Checklist
Additional context
Implementation Details:
loadGraph()infrastructure for consistencyEntitySummaryinterface separate from fullEntityKnowledgeGraphSummarytype for clear API contractsPerformance Benefits:
Design Decision: