Skip to main content
Glama

delete_relations

Remove specific relations between entities in the Memento MCP server while preserving the entities themselves, ensuring clean and precise data management.

Instructions

Remove specified relations between entities without deleting the entities themselves.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesArray of relations to delete.

Implementation Reference

  • src/server.js:126-140 (registration)
    MCP tool registration for 'delete_relations', including Zod input schema validation and async handler that delegates to KnowledgeGraphManager.deleteRelations and returns success message.
    this.tool( 'delete_relations', 'Remove specified relations between entities without deleting the entities themselves.', { relations: z.array(z.object({ from: z.string().describe('Source entity name.'), to: z.string().describe('Target entity name.'), relationType: z.string().describe('Type of the relation to remove.') })).describe('Array of relations to delete.') }, async ({ relations }) => { await this.#knowledgeGraphManager.deleteRelations(relations); return { content: [{ type: 'text', text: 'Relations deleted' }] }; } );
  • Inline handler function for the delete_relations tool that calls the manager and returns MCP content.
    async ({ relations }) => { await this.#knowledgeGraphManager.deleteRelations(relations); return { content: [{ type: 'text', text: 'Relations deleted' }] }; }
  • JSDoc type definition for the deleteRelations method in GraphRepository interface.
    * @property {(relations: Array<{ from: string, to: string, relationType: string }>) => Promise<void>} deleteRelations
  • KnowledgeGraphManager wrapper that delegates deleteRelations call to the underlying repository implementation.
    async deleteRelations(relations) { await this.#repository.deleteRelations(relations); }
  • PostgreSQL repository implementation of deleteRelations: resolves entity names to IDs and executes DELETE query for each matching relation.
    async deleteRelations(relations) { for (const relation of relations) { const fromId = await this.getEntityId(relation.from); const toId = await this.getEntityId(relation.to); if (!fromId || !toId) { continue; } await this.#query( `DELETE FROM relations WHERE from_id = $1 AND to_id = $2 AND relationtype = $3`, [ fromId, toId, relation.relationType ] ); } }
  • SQLite repository implementation of deleteRelations: resolves entity names to IDs and executes DELETE query for each matching relation.
    async deleteRelations(relations) { for (const relation of relations) { const fromId = await this.getEntityId(relation.from); const toId = await this.getEntityId(relation.to); if (!fromId || !toId) continue; await this.db.run( `DELETE FROM relations WHERE from_id = ? AND to_id = ? AND relationType = ?`, [fromId, toId, relation.relationType] ); } }

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