create_entities
Add multiple entities to a knowledge graph by specifying names, types, and associated observations, enabling structured data storage for improved memory and learning capabilities.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes |
Implementation Reference
- index.ts:603-609 (handler)The main handler function in KnowledgeGraphManager that implements the create_entities tool logic: loads the graph, filters out existing entities by name, appends new ones, saves the graph, and returns the created entities.async createEntities(entities: Entity[]): Promise<Entity[]> { 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:929-950 (schema)The input schema for the create_entities tool, specifying an object with an 'entities' array, each entity requiring 'name', 'entityType', and 'observations'.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"], }, }, }, required: ["entities"], },
- index.ts:926-951 (registration)Registration of the create_entities tool in the ListToolsRequestSchema handler, including name, description, and schema.{ 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"], }, }, }, required: ["entities"], }, },
- index.ts:1223-1224 (registration)Dispatch handler in the CallToolRequestSchema switch statement that invokes the createEntities method with tool arguments and formats the response.case "create_entities": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2) }] };