create_entities
Add multiple entities, including names, types, and associated observations, into a knowledge graph for persistent memory and reasoning across conversations in the MCP Memory Server.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes |
Input Schema (JSON Schema)
{
"properties": {
"entities": {
"items": {
"properties": {
"entityType": {
"description": "The type of the entity",
"type": "string"
},
"name": {
"description": "The name of the entity",
"type": "string"
},
"observations": {
"description": "An array of observation contents associated with the entity",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"name",
"entityType",
"observations"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"entities"
],
"type": "object"
}
Implementation Reference
- src/index.ts:69-74 (handler)The core handler function in KnowledgeGraphManager that executes the tool logic: loads the graph, filters out duplicate entities by name, appends new ones, saves the graph, and returns the newly 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;
- src/index.ts:24-28 (schema)TypeScript interface defining the structure of an Entity, used as the type for inputs to createEntities.interface Entity { name: string; entityType: string; observations: string[]; }
- src/index.ts:202-227 (registration)Tool registration in the listTools response, including name, description, and detailed inputSchema matching the Entity structure.{ 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"], }, },
- src/index.ts:384-385 (handler)Dispatch case in the CallToolRequestSchema handler that invokes the createEntities method and formats the response.case "create_entities": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2) }] };