Skip to main content
Glama

Graph Delete

graph_delete
Destructive

Permanently delete an entity node and all its relationships by ID. Use to remove duplicate or erroneous nodes from the graph.

Instructions

Permanently delete an entity node and all its edges by ID. Use for removing duplicate or erroneous nodes. Cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesEntity ID to delete

Implementation Reference

  • MCP tool registration and handler for graph_delete. Takes an entity ID, calls client.deleteEntity() with the current tenant. Returns error if entity not found.
    server.registerTool("graph_delete", {
      title: "Graph Delete",
      description:
        "Permanently delete an entity node and all its edges by ID. Use for removing duplicate or erroneous nodes. Cannot be undone.",
      inputSchema: {
        id: z.string().describe("Entity ID to delete"),
      },
      annotations: { destructiveHint: true },
    }, async (args) => {
      try {
        const deleted = await client.deleteEntity(currentTenant(), args.id);
        if (!deleted) {
          return toolError(`No entity found with id: ${args.id}`);
        }
        return toolResult({ action: "deleted", id: args.id });
      } catch (err) {
        return toolError(`graph_delete failed: ${err instanceof Error ? err.message : String(err)}`);
      }
    });
  • Input schema for graph_delete: a single required 'id' string parameter.
    inputSchema: {
      id: z.string().describe("Entity ID to delete"),
    },
  • Registration of graph_delete tool on the McpServer instance.
    server.registerTool("graph_delete", {
      title: "Graph Delete",
      description:
        "Permanently delete an entity node and all its edges by ID. Use for removing duplicate or erroneous nodes. Cannot be undone.",
      inputSchema: {
        id: z.string().describe("Entity ID to delete"),
      },
      annotations: { destructiveHint: true },
    }, async (args) => {
      try {
        const deleted = await client.deleteEntity(currentTenant(), args.id);
        if (!deleted) {
          return toolError(`No entity found with id: ${args.id}`);
        }
        return toolResult({ action: "deleted", id: args.id });
      } catch (err) {
        return toolError(`graph_delete failed: ${err instanceof Error ? err.message : String(err)}`);
      }
    });
  • Helper method on Neo4jClient that executes the Cypher DETACH DELETE query to permanently remove an entity and all its edges within a tenant.
    async deleteEntity(tenantId: string, id: string): Promise<boolean> {
      const rows = await this.run(
        `MATCH (n:Entity {tenant_id: $tenantId, id: $id}) DETACH DELETE n RETURN count(n) AS deleted`,
        { tenantId, id },
      );
      return Number(rows[0]?.["deleted"] ?? 0) > 0;
    }
Behavior5/5

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

The description discloses key behavioral traits beyond the destructiveHint annotation: it specifies that deletion is permanent, affects both the node and all its edges, and cannot be undone. This provides critical context for an AI agent to anticipate irreversible side effects.

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

Conciseness5/5

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

The description is extremely concise: two sentences with no redundant words. The first sentence clearly defines the action, and the second provides usage guidance and a warning. Every sentence adds value, making it efficient for an AI agent to parse.

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

Completeness5/5

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

Given the simplicity of the tool (one parameter, no output schema, destructive annotation), the description covers all necessary context: what it does, when to use it, and the irreversible nature. The annotations handle the remaining behavioral cues, making the description complete for this complexity level.

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 single parameter 'id' is fully described in the schema ('Entity ID to delete'), and the description's mention of 'by ID' adds no new semantic information. With 100% schema coverage, the description meets the baseline but does not enhance understanding beyond the schema.

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

Purpose5/5

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

The description clearly states the action ('Permanently delete an entity node and all its edges by ID') and the resource ('entity node and edges'), making the tool's purpose immediately understandable. It also specifies a use case ('removing duplicate or erroneous nodes'), which helps distinguish it from sibling tools like graph_prune or graph_decay.

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

Usage Guidelines4/5

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

The description provides a clear usage context ('Use for removing duplicate or erroneous nodes') and a crucial warning ('Cannot be undone'). However, it does not explicitly state when not to use the tool or mention alternatives, leaving some ambiguity for an AI agent deciding between this and other deletion-like tools.

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/stevepridemore/graph-memory'

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