You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1520a8b
Browse filesBrowse the repository at this point in the historyBrowse files
`create_entities` now reports the entities it skipped because their name already exists (or repeats earlier in the same call): the structured result lists them in a new optional `skipped` array, a second text item names them and points to `add_observations`, and the tool description says so. Skipped entities are still not created and their observations are still not added (#4887).
- Ignores entities with existing names (and repeats of a name earlier in the same call); their observations are not added
66
+
- Returns the created entities. When any were skipped, the structured result also lists their names in `skipped`, and a second text item says which were skipped (use `add_observations` to extend an existing entity)
Copy file name to clipboardExpand all lines: src/memory/__tests__/tools.test.ts
+35-13Lines changed: 35 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,8 @@ const expectedTools = [
92
92
{
93
93
name: "create_entities",
94
94
title: "Create Entities",
95
-
description: "Create multiple new entities in the knowledge graph",
95
+
description:
96
+
"Create multiple new entities in the knowledge graph. An entity whose name already exists, or repeats an earlier entity in the same call, is skipped and its observations are not added; the result lists the skipped names in `skipped`. Use add_observations to add observations to an existing entity.",
`Skipped ${skipped.length}${one ? "entity that already exists" : "entities that already exist"}: `+
120
+
`${skipped.join(", ")}. ${one ? "Its" : "Their"} observations were not added; `+
121
+
"use add_observations for existing entities."
122
+
);
123
+
}
124
+
105
125
// The KnowledgeGraphManager class contains all operations to interact with the knowledge graph
106
126
exportclassKnowledgeGraphManager{
107
127
constructor(privatememoryFilePath: string){}
@@ -511,12 +531,15 @@ export function createServer(memoryFilePath: string): McpServer {
511
531
"create_entities",
512
532
{
513
533
title: "Create Entities",
514
-
description: "Create multiple new entities in the knowledge graph",
534
+
description:
535
+
"Create multiple new entities in the knowledge graph. An entity whose name already exists, or repeats an earlier entity in the same call, is skipped and its observations are not added; the result lists the skipped names in `skipped`. Use add_observations to add observations to an existing entity.",
515
536
inputSchema: {
516
537
entities: z.array(EntitySchema),
517
538
},
518
539
outputSchema: {
519
540
entities: z.array(EntitySchema),
541
+
// Present only when at least one requested entity was skipped.
542
+
skipped: z.array(z.string()).optional(),
520
543
},
521
544
annotations: {
522
545
readOnlyHint: false,
@@ -528,11 +551,24 @@ export function createServer(memoryFilePath: string): McpServer {
0 commit comments