create_entities
Add multiple entities to your knowledge graph by defining names, types, and observations for structured memory storage in Obsidian.
Instructions
Create multiple new entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entities | Yes |
Implementation Reference
- The main handler function for the create_entities tool. It loads the current knowledge graph, checks if each provided entity already exists, saves new entities to individual markdown files using saveEntity, and returns the list of newly created entities.async createEntities(entities: Entity[]): Promise<Entity[]> { const graph = await this.loadGraph(); const newEntities: Entity[] = []; for (const entity of entities) { // Check if entity already exists if (graph.entities.some(e => e.name === entity.name)) { continue; } // Save the entity await this.saveEntity(entity, []); newEntities.push(entity); } return newEntities; }
- index.ts:32-53 (schema)Input schema (JSON Schema) for validating the arguments to the create_entities tool: requires an array of entities each with 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:29-54 (registration)Registration of the create_entities tool in the MCP server's listTools response, including name, description, and reference to 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:211-212 (registration)Tool call dispatcher in the CallToolRequestHandler: handles incoming calls to create_entities by invoking the storageManager handler and returning JSON-formatted result.case "create_entities": return { content: [{ type: "text", text: JSON.stringify(await storageManager.createEntities(args.entities as Entity[]), null, 2) }] };