Skip to main content
Glama

delete_entities

Remove specified entities and their related connections from the knowledge graph to maintain accurate and relevant data structures within the MCP Think Tank server.

Instructions

Delete multiple entities and their associated relations from the knowledge graph

Input Schema

NameRequiredDescriptionDefault
entityNamesYesArray of entity names to delete

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "entityNames": { "description": "Array of entity names to delete", "items": { "minLength": 1, "type": "string" }, "type": "array" } }, "required": [ "entityNames" ], "type": "object" }

Implementation Reference

  • The execute handler function for the delete_entities tool. It iterates over the provided entityNames, deletes each using graph.deleteEntity, tracks deleted and not-found entities, saves changes to memoryStore, and returns a JSON string with results.
    execute: async (args) => { const results = { deleted: [] as string[], notFound: [] as string[] }; // Using the lower-level graph for entity deletion for now // In a future update, we can add entity deletion to the MemoryStore itself for (const entityName of args.entityNames) { const success = graph.deleteEntity(entityName); if (success) { results.deleted.push(entityName); } else { results.notFound.push(entityName); } } // Save changes await memoryStore.save(); // Return as string return JSON.stringify({ deleted: results.deleted.length > 0 ? results.deleted : null, notFound: results.notFound.length > 0 ? results.notFound : null, message: `Deleted ${results.deleted.length} entities. ${results.notFound.length} entities not found.` }); }
  • The server.addTool call that registers the delete_entities tool, specifying name, description, parameters schema, and execute handler.
    server.addTool({ name: 'delete_entities', description: 'Delete multiple entities and their associated relations from the knowledge graph', parameters: Schemas.DeleteEntitiesSchema, execute: async (args) => { const results = { deleted: [] as string[], notFound: [] as string[] }; // Using the lower-level graph for entity deletion for now // In a future update, we can add entity deletion to the MemoryStore itself for (const entityName of args.entityNames) { const success = graph.deleteEntity(entityName); if (success) { results.deleted.push(entityName); } else { results.notFound.push(entityName); } } // Save changes await memoryStore.save(); // Return as string return JSON.stringify({ deleted: results.deleted.length > 0 ? results.deleted : null, notFound: results.notFound.length > 0 ? results.notFound : null, message: `Deleted ${results.deleted.length} entities. ${results.notFound.length} entities not found.` }); } });
  • Zod schema defining the input parameters for the delete_entities tool: an array of entity names to delete.
    export const DeleteEntitiesSchema = z.object({ entityNames: z.array(z.string().min(1)).describe('Array of entity names to delete') });

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/flight505/mcp-think-tank'

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