create_entities
Add multiple entities with names, types, and observations to the knowledge graph for persistent memory across chat interactions.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes |
Implementation Reference
- index.ts:136-156 (handler)The main handler function in KnowledgeGraphManager that implements the create_entities tool logic: loads the graph, filters out existing entities, adds new ones if any, saves the graph, and returns the newly added entities.async createEntities(entities: Entity[]): Promise<Entity[]> { console.error(`[Debug] Creating entities:`, entities); const graph = await this.loadGraph(); console.error(`[Debug] Current graph:`, graph); const newEntities = entities.filter(e => !graph.entities.some(existingEntity => existingEntity.name === e.name)); console.error(`[Debug] New entities to add:`, newEntities); if (newEntities.length > 0) { graph.entities.push(...newEntities.map(e => ({ name: e.name, entityType: e.entityType, observations: e.observations, subdomain: e.subdomain }))); await this.saveGraph(graph); } console.error(`[Debug] Final graph:`, graph); return newEntities; }
- index.ts:29-35 (schema)Type definition for Entity, used as input type for create_entities.interface Entity { name: string; entityType: string; observations: string[]; /** The loglass subdomain this knowledge belongs to. Optional for knowledge spanning multiple domains. */ subdomain?: string; }
- index.ts:360-389 (registration)Registration of the create_entities tool in the ListToolsRequestSchema response, including name, description, and inputSchema.{ 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" }, subdomain: { type: "string", description: "The loglass subdomain this knowledge belongs to (e.g., 'allocation', 'report', 'accounts', 'plans', 'actual' etc.). Can be omitted if the knowledge spans multiple domains.", }, observations: { type: "array", items: { type: "string" }, description: "An array of observation contents associated with the entity" }, }, required: ["name", "entityType", "observations"], }, }, }, required: ["entities"], }, },
- index.ts:553-554 (helper)Dispatch handler in the CallToolRequestSchema switch statement that invokes the createEntities method.case "create_entities": return createResponse(JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2));