Skip to main content
Glama
itseasy21

Knowledge Graph Memory Server

create_entities

Add multiple new entities to a knowledge graph by specifying names, types, and associated observations for persistent memory storage.

Instructions

Create multiple new entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entitiesYes

Implementation Reference

  • index.ts:80-91 (handler)
    Core handler function in KnowledgeGraphManager that implements the logic for creating new entities: loads graph, filters out duplicates by name, adds createdAt and version, appends to graph, saves to file, returns new 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))
        .map(e => ({
          ...e,
          createdAt: new Date().toISOString(),
          version: e.version || 1
        }));
      graph.entities.push(...newEntities);
      await this.saveGraph(graph);
      return newEntities;
    }
  • index.ts:285-309 (registration)
    Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema for create_entities.
      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"],
      },
    },
  • MCP tool dispatch handler in CallToolRequestSchema that invokes the createEntities method with parsed arguments and formats response.
    case "create_entities":
      return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2) }] };
  • TypeScript interface defining the Entity type used as input for create_entities.
      name: string;
      entityType: string;
      observations: string[];
      createdAt: string;
      version: number;
    }
  • JSON Schema for input validation of create_entities tool, specifying structure of entities 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"],
    },

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/itseasy21/mcp-knowledge-graph'

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