Skip to content

Memory MCP open_nodes returns empty relations array despite entity having relations in graph #3137

@broboa

Description

@broboa

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

  1. 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"
  }]
})
  1. Call open_nodes on the source entity:
open_nodes({ names: ["2025-12-17"] })
  1. Observe the result has an empty relations array

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:

  1. Include both incoming and outgoing relations in open_nodes response by default
  2. Add optional parameters to open_nodes to 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions