Skip to main content
Glama

Graph Delete

graph_delete
Destructive

Permanently delete an entity node and all its edges by ID to remove duplicate or erroneous nodes. This action is irreversible.

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

  • Registration of the 'graph_delete' tool via server.registerTool() with input schema and handler.
    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: accepts a single required 'id' string parameter.
    inputSchema: {
      id: z.string().describe("Entity ID to delete"),
    },
  • Handler function for graph_delete: calls client.deleteEntity() with tenant context and the entity ID, returns success or error.
    }, 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)}`);
      }
    });
  • The Neo4jClient.deleteEntity method that executes the Cypher query to DETACH DELETE the entity by tenant_id and id. Returns boolean indicating if any node was deleted.
    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?

Beyond the destructiveHint annotation, the description adds critical details: the deletion is permanent ('Cannot be undone') and cascading ('all its edges'). This fully discloses the behavioral impact.

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 only two sentences, directly action-oriented, and front-loaded with the verb and resource. No extraneous information.

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?

For a simple delete operation with one parameter and no output schema, the description covers purpose, usage, and behavioral implications comprehensively.

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 schema covers both parameters with descriptions, so the baseline is 3. The description does not add additional meaning beyond what the schema provides for the 'id' parameter.

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 (delete), the resource (entity node and all its edges), and the identifier (by ID). It distinguishes itself from sibling tools like graph_prune or graph_unmerge by specifying it is a permanent deletion of a single entity.

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 explicit use cases: 'for removing duplicate or erroneous nodes'. It does not explicitly mention when not to use or offer alternatives, but the context is clear enough for selection.

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