Skip to main content
Glama

create_entities

Add multiple new entities to a knowledge graph by specifying names, types, and associated observations in a memory file.

Instructions

Create multiple new entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entitiesYes
memoryFilePathYesThe path to the memory file

Implementation Reference

  • Core handler function in KnowledgeGraphManager that creates new entities by loading the graph from file, filtering out duplicates based on entity name, appending new entities, saving back to file, and returning the newly added entities.
    async createEntities( entities: Entity[], filepath: string ): Promise<Entity[]> { await this.setMemoryFilePath(filepath); 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; }
  • Tool schema definition including name, description, and detailed input schema specifying the structure for entities array and memoryFilePath.
    { 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"], }, }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["entities", "memoryFilePath"], }, },
  • index.ts:602-617 (registration)
    Registration and dispatching logic in the CallToolRequestSchema handler that invokes the createEntities method with parsed arguments and formats the response as JSON text.
    case "create_entities": return { content: [ { type: "text", text: JSON.stringify( await knowledgeGraphManager.createEntities( args.entities as Entity[], args.memoryFilePath as string ), null, 2 ), }, ], };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BRO3886/mcp-memory-custom'

If you have feedback or need assistance with the MCP directory API, please join our Discord server