Skip to main content
Glama

delete_relations

Remove specified relationships between stored entities while preserving the entities themselves in the Memento memory server.

Instructions

Remove specified relations between entities without deleting the entities themselves.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesArray of relations to delete.

Implementation Reference

  • Handler function that invokes the knowledge graph manager's deleteRelations method and returns a textual success confirmation.
    async ({ relations }) => { await this.#knowledgeGraphManager.deleteRelations(relations); return { content: [{ type: 'text', text: 'Relations deleted' }] }; }
  • Zod schema validating the input as an array of relations, each with 'from', 'to', and 'relationType' string fields.
    { 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.') },
  • src/server.js:126-140 (registration)
    MCP server tool registration call for 'delete_relations', including description, input schema, and handler.
    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' }] }; } );
  • SQLite GraphRepository implementation of deleteRelations: iterates relations, gets entity IDs, executes DELETE SQL if both entities exist.
    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] ); } }
  • PostgreSQL GraphRepository implementation of deleteRelations: similar iteration, ID resolution, and DELETE query using parameterized query.
    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 ] ); } }

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