Skip to content

memory: delete tools report success when nothing matched #4740

Description

@ConnorMoss02

delete_entities, delete_observations and delete_relations return success: true with a hardcoded message regardless of what matched.

src/memory/index.ts:

async deleteEntities(entityNames: string[]): Promise<void> {
  const graph = await this.loadGraph();
  graph.entities = graph.entities.filter(e => !entityNames.includes(e.name));
structuredContent: { success: true, message: "Entities deleted successfully" }

The method returns void, so the handler never learns whether a name existed. A call naming an entity that is not in the graph reports the same success as one that deleted something.

Reproduction, against the real KnowledgeGraphManager:

await manager.createEntities([{ name: "Alice", entityType: "person", observations: [] }]);
await callTool("delete_entities", { entityNames: ["Alise"] });
// → { success: true, message: "Entities deleted successfully" }
// Alice is still in the graph.

Same for delete_observations with an entity or observation that is absent, and delete_relations with a relation that matches nothing.

addObservations at line 167 throws Entity with name ${o.entityName} not found for the same condition, so the two paths in this file answer differently.

README.md documents the tools as silent when a target is missing, so not throwing looks intentional. The response claiming a deletion that did not occur is the part that appears unintended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions