Skip to main content
Glama
YuNaga224
by YuNaga224

delete_relations

Remove specified relations from a knowledge graph stored in Obsidian Memory MCP by defining the entities and relation types to delete. Streamlines graph management by eliminating unwanted connections.

Instructions

Delete multiple relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Implementation Reference

  • Handler for the delete_relations tool call, dispatching to storageManager.deleteRelations and returning success response.
    case "delete_relations": await storageManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
  • Input schema defining the expected arguments: 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:142-164 (registration)
    Registration of the delete_relations tool in the ListTools response, including name, description, and 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"], }, },
  • Supporting method in MarkdownStorageManager that implements relation deletion by editing markdown files of source entities.
    async deleteRelations(relations: Relation[]): Promise<void> { for (const relation of relations) { const fromPath = getEntityPath(relation.from); try { const content = await fs.readFile(fromPath, 'utf-8'); const updatedContent = removeRelationFromContent(content, relation); await fs.writeFile(fromPath, updatedContent, 'utf-8'); } catch (error) { if (error instanceof Error && 'code' in error && (error as any).code !== 'ENOENT') { throw new Error(`Failed to delete relation from ${relation.from}: ${error}`); } } } }

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/YuNaga224/obsidian-memory-mcp'

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