Skip to main content
Glama
T1nker-1220

Knowledge Graph Memory Server

delete_relations

Remove specified relations from the knowledge graph by defining the originating entity, terminating entity, and relation type for each entry.

Instructions

Delete multiple relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Implementation Reference

  • The main handler function in KnowledgeGraphManager that deletes the specified relations by loading the graph, filtering out matching relations, and saving the updated graph.
    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); }
  • Input schema definition for the delete_relations tool, specifying the structure of the relations array to delete.
    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:1039-1061 (registration)
    Tool registration in the ListTools handler, defining the delete_relations tool with its 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"], }, },
  • index.ts:1235-1237 (registration)
    Dispatch handler in the CallToolRequestSchema switch statement that calls the deleteRelations method and returns success response.
    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/T1nker-1220/memories-with-lessons-mcp-server'

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