create_entities
Add multiple new entities to a knowledge graph by specifying names, types, and associated observations in a memory file.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes | ||
| memoryFilePath | Yes | The path to the memory file |
Implementation Reference
- index.ts:120-133 (handler)Core handler function in KnowledgeGraphManager that creates new entities by loading the graph from file, filtering out duplicates based on entity name, appending new entities, saving back to file, and returning the newly added entities.async createEntities( entities: Entity[], filepath: string ): Promise<Entity[]> { await this.setMemoryFilePath(filepath); const graph = await this.loadGraph(); const newEntities = entities.filter( (e) => !graph.entities.some((existingEntity) => existingEntity.name === e.name) ); graph.entities.push(...newEntities); await this.saveGraph(graph); return newEntities; }
- index.ts:325-361 (schema)Tool schema definition including name, description, and detailed input schema specifying the structure for entities array and memoryFilePath.{ name: "create_entities", description: "Create multiple new entities in the knowledge graph", inputSchema: { type: "object", properties: { entities: { type: "array", items: { type: "object", properties: { name: { type: "string", description: "The name of the entity", }, entityType: { type: "string", description: "The type of the entity", }, observations: { type: "array", items: { type: "string" }, description: "An array of observation contents associated with the entity", }, }, required: ["name", "entityType", "observations"], }, }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["entities", "memoryFilePath"], }, },
- index.ts:602-617 (registration)Registration and dispatching logic in the CallToolRequestSchema handler that invokes the createEntities method with parsed arguments and formats the response as JSON text.case "create_entities": return { content: [ { type: "text", text: JSON.stringify( await knowledgeGraphManager.createEntities( args.entities as Entity[], args.memoryFilePath as string ), null, 2 ), }, ], };