Skip to main content
Glama

delete_relations

Remove specified relationships between entities stored in the MCP Memory Server's knowledge graph to maintain accurate and relevant data connections for improved reasoning and retrieval.

Instructions

Delete multiple relations from the knowledge graph

Input Schema

NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Input Schema (JSON Schema)

{ "properties": { "relations": { "description": "An array of relations to delete", "items": { "properties": { "from": { "description": "The name of the entity where the relation starts", "type": "string" }, "relationType": { "description": "The type of the relation", "type": "string" }, "to": { "description": "The name of the entity where the relation ends", "type": "string" } }, "required": [ "from", "to", "relationType" ], "type": "object" }, "type": "array" } }, "required": [ "relations" ], "type": "object" }

Implementation Reference

  • Core handler function in KnowledgeGraphManager that loads the graph, filters out the specified relations, and saves the updated graph to persist the deletions.
    async deleteRelations(relations: Relation[]): Promise<void> { const graph = await this.loadGraph(); graph.relations = graph.relations.filter(r => !relations.some(delRelation => r.from === delRelation.from && r.to === delRelation.to && r.relationType === delRelation.relationType )); await this.saveGraph(graph); }
  • src/index.ts:315-337 (registration)
    Tool registration in the ListToolsRequestHandler, defining the name, description, and input schema for the delete_relations tool.
    { name: "delete_relations", description: "Delete multiple relations from the knowledge graph", 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"], }, },
  • Dispatch logic in the CallToolRequestHandler that calls the KnowledgeGraphManager.deleteRelations method with the provided arguments and returns a success message.
    case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
  • TypeScript interface defining the structure of a Relation object used by the delete_relations tool.
    interface Relation { from: string; to: string; relationType: string; }

Other Tools

Related Tools

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/StevenWangler/mcp-memory-server'

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