Skip to main content
Glama

create_entities

Add and initialize entities in Memento's knowledge graph, ensuring uniqueness and optionally attaching initial observations for each entity.

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

  • The core handler function that implements the create_entities tool logic: creates entities if they do not exist and adds observations if provided.
    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; }
  • src/server.js:44-65 (registration)
    Registers the 'create_entities' tool with the MCP server, defining its description, input schema using Zod, and handler that delegates to KnowledgeGraphManager.createEntities.
    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 ) }] }) );
  • Zod schema defining the input parameters for the create_entities tool: an array of entities 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.') },

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