Skip to main content
Glama

delete_entities

Remove entities and their associated data from the Memento MCP server to manage stored information by specifying entity names for deletion.

Instructions

Delete entities (and cascaded observations/relations) by their names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityNamesYesNames of entities to delete.

Implementation Reference

  • MCP server tool registration, schema definition, and handler function for 'delete_entities'. Delegates to KnowledgeGraphManager.deleteEntities and returns success response.
    // Tool: delete_entities
    this.tool(
        'delete_entities',
        'Delete entities (and cascaded observations/relations) by their names.',
        {
            entityNames: z.array(z.string()).describe('Names of entities to delete.')
        },
        async ({ entityNames }) => {
            await this.#knowledgeGraphManager.deleteEntities(entityNames);
            return { content: [{ type: 'text', text: 'Entities deleted' }] };
        }
    );
  • KnowledgeGraphManager.deleteEntities method that delegates the deletion to the underlying GraphRepository implementation.
    async deleteEntities(names) {
        await this.#repository.deleteEntities(names);
    }
  • SQLite-specific implementation of deleteEntities, executing DELETE on entities table (cascades to observations and relations).
    async deleteEntities(names) {
        if (!names.length) {
            return;
        }
    
        const placeholders = names.map(() => '?').join(',');
        await this.db.run(`DELETE FROM entities WHERE name IN (${placeholders})`, names);
    }
  • PostgreSQL-specific implementation of deleteEntities, executing DELETE on entities table using ANY array (cascades).
    async deleteEntities(names) {
        if (!names.length) {
            return;
        }
    
        await this.#query(
            `DELETE
             FROM entities
             WHERE name = ANY ($1)`,
            [ names ]
        );
    }
  • Interface definition (JSDoc) for GraphRepository.deleteEntities method.
    * @property {(names: string[]) => Promise<void>} deleteEntities

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