Skip to main content
Glama
yodakeisuke

Knowledge Graph Memory Server

by yodakeisuke

create_entities

Add multiple entities to a knowledge graph, specifying names, types, and associated observations, to enhance memory integration in chat applications.

Instructions

Create multiple new entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entitiesYes

Implementation Reference

  • The core handler function that executes the create_entities tool logic: loads the knowledge graph from file, deduplicates new entities by name, adds them to the graph, persists the changes, and returns the newly added entities.
    async createEntities(entities: Entity[]): Promise<Entity[]> { console.error(`[Debug] Creating entities:`, entities); const graph = await this.loadGraph(); console.error(`[Debug] Current graph:`, graph); const newEntities = entities.filter(e => !graph.entities.some(existingEntity => existingEntity.name === e.name)); console.error(`[Debug] New entities to add:`, newEntities); if (newEntities.length > 0) { graph.entities.push(...newEntities.map(e => ({ name: e.name, entityType: e.entityType, observations: e.observations, subdomain: e.subdomain }))); await this.saveGraph(graph); } console.error(`[Debug] Final graph:`, graph); return newEntities; }
  • Input schema for the create_entities tool, specifying an object with an 'entities' array, where each entity has required 'name', 'entityType', 'observations', and optional 'subdomain'.
    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" }, subdomain: { type: "string", description: "The loglass subdomain this knowledge belongs to (e.g., 'allocation', 'report', 'accounts', 'plans', 'actual' etc.). Can be omitted if the knowledge spans multiple domains.", }, observations: { type: "array", items: { type: "string" }, description: "An array of observation contents associated with the entity" }, }, required: ["name", "entityType", "observations"], }, }, }, required: ["entities"], },
  • index.ts:361-389 (registration)
    Registration of the 'create_entities' tool in the ListToolsRequestSchema handler, including name, description, and 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" }, subdomain: { type: "string", description: "The loglass subdomain this knowledge belongs to (e.g., 'allocation', 'report', 'accounts', 'plans', 'actual' etc.). Can be omitted if the knowledge spans multiple domains.", }, observations: { type: "array", items: { type: "string" }, description: "An array of observation contents associated with the entity" }, }, required: ["name", "entityType", "observations"], }, }, }, required: ["entities"], }, },
  • TypeScript interface defining the Entity type used by the create_entities tool.
    interface Entity { name: string; entityType: string; observations: string[]; /** The loglass subdomain this knowledge belongs to. Optional for knowledge spanning multiple domains. */ subdomain?: string; }
  • Dispatch case in the CallToolRequestSchema handler that invokes the createEntities handler with parsed arguments and formats the response.
    case "create_entities": return createResponse(JSON.stringify(await knowledgeGraphManager.createEntities(args.entities as Entity[]), null, 2));

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/yodakeisuke/mcp-memory-domain-knowledge'

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