Skip to main content
Glama

delete_entities

Remove entities and their relationships from a knowledge graph stored in a specified memory file to maintain data accuracy and relevance.

Instructions

Delete multiple entities and their associated relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityNamesYesAn array of entity names to delete
memoryFilePathYesThe path to the memory file

Implementation Reference

  • The handler function in KnowledgeGraphManager that implements the deletion of specified entities and all relations connected to them from the graph stored in the memory file.
    async deleteEntities(entityNames: string[], filepath: string): Promise<void> { await this.setMemoryFilePath(filepath); const graph = await this.loadGraph(); graph.entities = graph.entities.filter( (e) => !entityNames.includes(e.name) ); graph.relations = graph.relations.filter( (r) => !entityNames.includes(r.from) && !entityNames.includes(r.to) ); await this.saveGraph(graph); }
  • The tool schema definition including name, description, and input schema for validating parameters (entityNames array and memoryFilePath).
    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", }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["entityNames", "memoryFilePath"], }, },
  • index.ts:653-660 (registration)
    The dispatch case in the CallToolRequestHandler switch statement that invokes the deleteEntities handler with parsed arguments and returns success response.
    case "delete_entities": await knowledgeGraphManager.deleteEntities( args.entityNames as string[], args.memoryFilePath as string ); return { content: [{ type: "text", text: "Entities deleted successfully" }], };

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/BRO3886/mcp-memory-custom'

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