Repository navigation
Description
Describe the bug
The open_nodes tool returns an empty relations array even when the requested entity has outgoing relations in the knowledge graph. This makes it impossible to traverse the graph from a specific node without calling read_graph and filtering the entire dataset client-side.
To Reproduce
- Create two entities and a relation between them:
create_entities({
entities: [
{ name: "2025-12-17", entityType: "work-day", observations: [] },
{ name: "incident/example", entityType: "incident", observations: ["Test incident"] }
]
})
create_relations({
relations: [{
from: "2025-12-17",
to: "incident/example",
relationType: "worked-on"
}]
})- Call
open_nodeson the source entity:
open_nodes({ names: ["2025-12-17"] })- Observe the result has an empty
relationsarray
Expected behavior
open_nodes should return outgoing relations from the requested entity, similar to how graph databases return edges when querying a node. The response should include:
{
"entities": [
{
"type": "entity",
"name": "2025-12-17",
"entityType": "work-day",
"observations": []
}
],
"relations": [
{
"type": "relation",
"from": "2025-12-17",
"to": "incident/example",
"relationType": "worked-on"
}
]
}Logs
Actual response from open_nodes:
{
"entities": [
{
"type": "entity",
"name": "2025-12-17",
"entityType": "work-day",
"observations": []
}
],
"relations": []
}Calling read_graph confirms the relation exists in the graph.
Additional context
This limitation forces users to call read_graph (which returns the entire knowledge graph) and filter client-side to find relations for specific entities. This doesn't scale as the graph grows.
Use case: Daily work tracking where date entities link to topic entities via worked-on relations. To generate a daily summary for a specific date, we need to find all topics linked from that date, but open_nodes doesn't provide this information.
Suggested solutions:
- Include both incoming and outgoing relations in
open_nodesresponse by default - Add optional parameters to
open_nodesto control relation inclusion (e.g.,includeRelations: "both" | "outgoing" | "incoming" | "none",relationDepth: number)
Note: Both directions are useful for different queries. Outgoing relations answer "what does this entity link to?" (e.g., which topics were worked on this date?), while incoming relations answer "what links to this entity?" (e.g., which dates was this incident worked on?). Most graph databases provide both by default.
Activity
broboa commentedon Dec 18, 2025
The root cause is in the
openNodesmethod at line 210-212 ofsrc/memory/index.ts:This filters relations to only include those where both endpoints are in the requested entity set. When you query
open_nodes(['2025-12-17']), it only returns relations where bothfromandtoare '2025-12-17', which is why you get an empty array.Changing the
&&to||would fix this, including relations where at least one endpoint matches. This would return both:frommatches) - answers "what does this entity link to?"tomatches) - answers "what links to this entity?"This would match standard graph database behavior and enable graph traversal from specific nodes.
fix(memory): return relations connected to requested nodes in openNod…
fix: include outgoing relations in open_nodes
Fix modelcontextprotocol#3137: Include incoming and outgoing relation…
test(memory): mark the tests that pin known bugs
test(memory): mark the tests that pin known bugs