create_entities
Add multiple entities to a knowledge graph by specifying names, types, and associated observations, enabling AI systems to store and recall information across interactions.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes |
Implementation Reference
- index.ts:80-90 (handler)Core handler function in KnowledgeGraphManager that creates new entities: loads graph, filters out existing by name, adds metadata (createdAt, version), appends to entities, saves graph, returns new ones.async createEntities(entities: Entity[]): Promise<Entity[]> { const graph = await this.loadGraph(); const newEntities = entities.filter(e => !graph.entities.some(existingEntity => existingEntity.name === e.name)) .map(e => ({ ...e, createdAt: new Date().toISOString(), version: e.version || 1 })); graph.entities.push(...newEntities); await this.saveGraph(graph); return newEntities;
- index.ts:287-308 (schema)Input schema for create_entities tool defining structure: object with 'entities' array of objects each having required 'name', 'entityType', 'observations' array.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:284-309 (registration)Registration of create_entities tool in the ListToolsRequestSchema handler's tools array, including name, description, and input 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:514-515 (registration)Dispatch case in CallToolRequestSchema handler that invokes the createEntities handler with parsed arguments and formats response as MCP content.case "create_entities": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2) }] };
- index.ts:31-37 (schema)TypeScript interface defining the Entity type used by createEntities.interface Entity { name: string; entityType: string; observations: string[]; createdAt: string; version: number; }