Skip to main content
Glama
YuNaga224
by YuNaga224

delete_entities

Remove entities and their connections from a knowledge graph in Obsidian Memory MCP to maintain organized data structures.

Instructions

Delete multiple entities and their associated relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityNamesYesAn array of entity names to delete

Implementation Reference

  • Core handler function that deletes entity Markdown files and cleans up incoming relations from remaining entities.
    async deleteEntities(entityNames: string[]): Promise<void> { for (const name of entityNames) { const filePath = getEntityPath(name); try { await fs.unlink(filePath); } catch (error) { if (error instanceof Error && 'code' in error && (error as any).code !== 'ENOENT') { throw new Error(`Failed to delete entity ${name}: ${error}`); } } } // Remove relations pointing to deleted entities const remainingRelations = await this.loadAllRelations(); const relationsToRemove = remainingRelations.filter( r => entityNames.includes(r.to) ); for (const relation of relationsToRemove) { 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) { // Entity might have been deleted } } }
  • Dispatch handler in the main CallToolRequestSchema handler that invokes the storage manager's deleteEntities method.
    case "delete_entities": await storageManager.deleteEntities(args.entityNames as string[]); return { content: [{ type: "text", text: "Entities deleted successfully" }] };
  • index.ts:102-116 (registration)
    Tool registration in ListToolsRequestSchema response, defining the name, description, and input schema for delete_entities.
    { name: "delete_entities", description: "Delete multiple entities and their associated relations from the knowledge graph", inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], }, },
  • Input schema definition for the delete_entities tool.
    inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], }, },

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