Skip to main content
Glama
IzumiSy

MCP DuckDB Knowledge Graph Memory Server

delete_relations

Remove specified relationships between entities from the knowledge graph to maintain data accuracy and relevance.

Instructions

Delete multiple relations from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYesAn array of relations to delete

Implementation Reference

  • src/server.ts:132-156 (registration)
    MCP tool registration for 'delete_relations', including input schema with Zod validation for relations array and an inline asynchronous handler that calls the manager's deleteRelations method and returns a success message.
    server.tool(
      "delete_relations",
      "Delete multiple relations from the knowledge graph",
      {
        relations: z
          .array(
            z.object({
              from: z
                .string()
                .describe("The name of the entity where the relation starts"),
              to: z
                .string()
                .describe("The name of the entity where the relation ends"),
              relationType: z.string().describe("The type of the relation"),
            })
          )
          .describe("An array of relations to delete"),
      },
      async ({ relations }) => {
        await knowledgeGraphManager.deleteRelations(relations);
        return {
          content: [{ type: "text", text: "Relations deleted successfully" }],
        };
      }
    );
  • Core helper function in KnowledgeGraphManager that implements the deletion of multiple relations from the SQLite 'relations' table using a transaction for atomicity, with rollback on error.
    async deleteRelations(relations: Relation[]): Promise<void> {
      using conn = await this.getConn();
    
      try {
        // Begin transaction
        await conn.execute("BEGIN TRANSACTION");
    
        // Delete each relation
        for (const relation of relations) {
          await conn.execute(
            "DELETE FROM relations WHERE from_entity = ? AND to_entity = ? AND relationType = ?",
            [relation.from, relation.to, relation.relationType]
          );
        }
    
        // Commit transaction
        await conn.execute("COMMIT");
      } catch (error: unknown) {
        // Rollback in case of error
        await conn.execute("ROLLBACK");
        this.logger.error("Error deleting relations", extractError(error));
        throw error;
      }
    }
  • TypeScript interface defining the deleteRelations method signature, specifying input as Relation[] and return Promise<void>.
    export type KnowledgeGraphManagerInterface = {
      createEntities(entities: Entity[]): Promise<Entity[]>;
      createRelations(relations: Relation[]): Promise<Relation[]>;
      addObservations(observations: Array<Observation>): Promise<Observation[]>;
      deleteEntities(entityNames: string[]): Promise<void>;
      deleteObservations(deletions: Array<Observation>): Promise<void>;
      deleteRelations(relations: Relation[]): Promise<void>;
      searchNodes(query: string): Promise<KnowledgeGraph>;
      openNodes(names: string[]): Promise<KnowledgeGraph>;
    };
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. It states the tool deletes relations, implying a destructive mutation, but does not cover critical aspects such as permissions required, whether deletions are reversible, error handling, or rate limits. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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 a single, direct sentence that efficiently conveys the core action without unnecessary words. It is front-loaded with the key information ('Delete multiple relations'), making it easy to parse and understand quickly, with no wasted verbiage.

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?

Given the tool's destructive nature (deleting relations), lack of annotations, and no output schema, the description is insufficient. It does not address the implications of deletion, potential side effects, or what to expect upon success or failure, leaving the agent with incomplete context for safe and effective use.

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, clearly documenting the 'relations' parameter as an array of objects with 'from', 'to', and 'relationType' fields. The description adds no additional semantic context beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema coverage without enhancing parameter understanding.

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') and resource ('multiple relations from the knowledge graph'), which is specific and unambiguous. However, it does not explicitly distinguish this tool from its sibling 'delete_entities' or 'delete_observations', which would require mentioning what relations are versus entities or observations to clarify differentiation.

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 like 'delete_entities' or 'delete_observations', nor does it mention prerequisites or context for deletion. It lacks explicit instructions on usage scenarios, leaving the agent to infer based on tool names alone.

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/IzumiSy/mcp-duckdb-memory-server'

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