Skip to main content
Glama

delete_relations

Remove unwanted connections from your knowledge graph memory by specifying relation details between entities to maintain accurate data relationships.

Instructions

Delete multiple relations from your Memento MCP knowledge graph memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Implementation Reference

  • MCP tool handler that dispatches the delete_relations call to KnowledgeGraphManager and returns a success response.
    case 'delete_relations': await knowledgeGraphManager.deleteRelations(args.relations); return { content: [{ type: 'text', text: 'Relations deleted successfully' }] };
  • Defines the tool schema, description, and input validation structure for delete_relations, also serving as registration in the tools list.
    { name: 'delete_relations', description: 'Delete multiple relations from your Memento MCP knowledge graph memory', inputSchema: { type: 'object', properties: { relations: { type: 'array', items: { type: 'object', properties: { from: { type: 'string', description: 'The name of the entity where the relation starts', }, to: { type: 'string', description: 'The name of the entity where the relation ends', }, relationType: { type: 'string', description: 'The type of the relation' }, }, required: ['from', 'to', 'relationType'], }, description: 'An array of relations to delete', }, }, required: ['relations'], }, },
  • Core logic for deleting relations, delegating to storage provider or file fallback.
    async deleteRelations(relations: Relation[]): Promise<void> { if (!relations || relations.length === 0) { return; } if (this.storageProvider) { // Use storage provider for deleting relations await this.storageProvider.deleteRelations(relations); } else { // Fallback to file-based implementation const graph = await this.loadGraph(); // Filter out relations that match the ones to delete graph.relations = graph.relations.filter((r) => { // Check if this relation matches any in the deletion list return !relations.some( (delRel) => r.from === delRel.from && r.relationType === delRel.relationType && r.to === delRel.to ); }); await this.saveGraph(graph); } }
  • File-based storage provider implementation of deleteRelations using graph filtering.
    async deleteRelations(relations: Relation[]): Promise<void> { await this.loadGraph(); for (const relation of relations) { this.graph.relations = this.graph.relations.filter( (r) => !( r.from === relation.from && r.to === relation.to && r.relationType === relation.relationType ) ); } await this.saveGraph(this.graph); }

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/gannonh/memento-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server