feat(memory): add read_graph_summary function for efficient entity overview #2619
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.
Description
Add
read_graph_summary
function 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_nodes
Server Details
read_graph_summary
tool)Motivation and Context
The existing
read_graph
function 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_summary
function solves this by providing:LLMs can then use the existing
open_nodes
function 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_nodes
for 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 consistencyEntitySummary
interface separate from fullEntity
KnowledgeGraphSummary
type for clear API contractsPerformance Benefits:
Design Decision: