Skip to main content
Glama
modelcontextprotocol

Knowledge Graph Memory Server

create_entities

Add multiple entities to the knowledge graph, specifying name, type, and associated observations, to enhance memory storage in the Knowledge Graph Memory Server.

Instructions

Create multiple new entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entitiesYes

Implementation Reference

  • Registers the 'create_entities' MCP tool, defining input/output schemas (using EntitySchema) and a thin handler that delegates to KnowledgeGraphManager.createEntities.
    server.registerTool( "create_entities", { title: "Create Entities", description: "Create multiple new entities in the knowledge graph", inputSchema: { entities: z.array(EntitySchema) }, outputSchema: { entities: z.array(EntitySchema) } }, async ({ entities }) => { const result = await knowledgeGraphManager.createEntities(entities); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], structuredContent: { entities: result } }; } );
  • Executes the core logic for creating entities: loads the knowledge graph from JSONL, filters out duplicates by name, appends new entities, saves back to file, returns 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; }
  • Zod schema for validating Entity objects used in the create_entities tool input and output.
    const EntitySchema = z.object({ name: z.string().describe("The name of the entity"), entityType: z.string().describe("The type of the entity"), observations: z.array(z.string()).describe("An array of observation contents associated with the entity") });
  • TypeScript interface defining the structure of an Entity, used throughout the knowledge graph and tool.
    export interface Entity { name: string; entityType: string; observations: string[]; }

Other Tools

Related Tools

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/modelcontextprotocol/knowledge-graph-memory-server'

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