Skip to main content
Glama
YuNaga224

Obsidian Memory MCP

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"],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Delete' clearly indicates a destructive operation, the description doesn't specify whether this deletion is permanent or reversible, what permissions are required, whether there are rate limits, what happens to orphaned data, or what confirmation/response to expect. For a destructive tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for a tool with one parameter, though it could potentially be more front-loaded with critical behavioral information given the destructive nature of the operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address critical context like whether deletions are permanent, what permissions are needed, what happens to associated data, or what the tool returns. The mention of 'associated relations' being deleted is helpful but doesn't compensate for the broader behavioral gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'entityNames' clearly documented as 'An array of entity names to delete'. The description adds that these are 'multiple entities' and mentions 'associated relations' will also be deleted, providing some additional context about side effects. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete multiple entities and their associated relations') and the resource ('from the knowledge graph'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'delete_observations' or 'delete_relations', which handle different resource types in the same knowledge graph system.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this deletion operation is appropriate, what prerequisites might exist, or how it differs from other deletion tools like 'delete_observations' or 'delete_relations' that operate on different graph components.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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