Skip to main content
Glama

create_entities

Add entities to a knowledge graph, inserting new entries and optionally attaching initial observations for data organization.

Instructions

Create entities in the knowledge graph. Inserts each entity if not exists and optionally seeds it with observations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entitiesYesArray of entities to create.

Implementation Reference

  • Core handler function that creates entities in the knowledge graph if they do not already exist, optionally adds observations, and returns the list of newly created entities.
    async createEntities(entities) { const created = []; for (const entity of entities) { const existingId = await this.#repository.getEntityId(entity.name); if (!existingId) { await this.#repository.createEntity(entity.name, entity.entityType); created.push(entity); } if (entity.observations?.length) { await this.addObservations([{ entityName: entity.name, contents: entity.observations }]); } } return created; }
  • Zod schema defining the input parameters for the create_entities tool: an array of entities each with name, entityType, and optional observations.
    { entities: z.array(z.object({ name: z.string().describe('Unique name of the entity.'), entityType: z.string().describe('Type or category of the entity.'), observations: z.array(z.string()).optional() .describe('Initial list of observations to attach to the entity.') })).describe('Array of entities to create.') },
  • src/server.js:44-65 (registration)
    Registers the 'create_entities' MCP tool with name, description, input schema using Zod, and async handler that delegates to KnowledgeGraphManager.createEntities and returns JSON response.
    this.tool( 'create_entities', 'Create entities in the knowledge graph. Inserts each entity if not exists and optionally seeds it with observations.', { entities: z.array(z.object({ name: z.string().describe('Unique name of the entity.'), entityType: z.string().describe('Type or category of the entity.'), observations: z.array(z.string()).optional() .describe('Initial list of observations to attach to the entity.') })).describe('Array of entities to create.') }, async ({ entities }) => ({ content: [{ type: 'text', text: JSON.stringify( await this.#knowledgeGraphManager.createEntities(entities), 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/iAchilles/memento'

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