Skip to main content
Glama
itseasy21

Knowledge Graph Memory Server

delete_relations

Remove specified connections between entities in the knowledge graph to maintain accurate relationship data.

Instructions

Delete multiple relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Implementation Reference

  • The core handler function in KnowledgeGraphManager that deletes the specified relations by filtering them out from the loaded graph and saving the changes to the memory file.
    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); }
  • JSON Schema defining the input structure for the delete_relations tool, specifying an array of relations with from, to, and relationType fields.
    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"], },
  • index.ts:526-528 (registration)
    Registers the handler for the delete_relations tool in the CallToolRequestHandler switch statement, dispatching calls to KnowledgeGraphManager.deleteRelations.
    case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
  • index.ts:397-419 (registration)
    Tool registration in the ListToolsRequestHandler, including name, description, and input schema.
    { 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"], }, },
  • TypeScript interface defining the structure of a Relation object used by the delete_relations tool.
    interface Relation { from: string; to: string; relationType: string; createdAt: string; version: number; }

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/itseasy21/mcp-knowledge-graph'

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