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
| Name | Required | Description | Default |
|---|---|---|---|
| relations | Yes | Array 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' }] }; } );
- src/server.js:136-139 (handler)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' }] }; }
- src/graph-repository.js:29-29 (schema)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); }
- src/postgres/graph-repo.js:259-276 (helper)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 ] ); } }
- src/sqlite/graph-repo.js:158-168 (helper)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] ); } }