Skip to main content
Glama

Remove an edge between two memories

memory_unlink
DestructiveIdempotent

Remove a specific edge between two memories by providing the exact from_id, to_id, and edge_type triple. Use to retract incorrect links without deleting the full memory records.

Instructions

Remove a previously created edge — pass the exact (from_id, to_id, edge_type) triple used at creation time. No wildcards. Idempotent. Use to retract incorrect links. To retract a whole memory, prefer memory_delete (keeps audit trail).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_idYesSource memory id of the edge to remove.
to_idYesTarget memory id of the edge to remove.
edge_typeYesEdge type that was used when the edge was created. Must match exactly.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes`Edge removed: <from> -[<edge_type>]-> <to>` on success, or `Edge not found.` when the triple does not exist.

Implementation Reference

  • Core handler function that calls edgesRepo.unlink() to remove a typed edge between two memories, returning a success or 'not found' message.
    export async function handleMemoryUnlink(
      edgesRepo: EdgesRepo,
      params: MemoryUnlinkParams
    ): Promise<string> {
      const removed = edgesRepo.unlink(params.from_id, params.to_id, params.edge_type);
      if (!removed) {
        return `No edge found: ${params.from_id} --[${params.edge_type}]--> ${params.to_id}`;
      }
      return `Unlinked ${params.from_id} --[${params.edge_type}]--> ${params.to_id}`;
    }
  • Input parameters interface for the memory_unlink tool: requires from_id, to_id, and edge_type.
    export interface MemoryUnlinkParams {
      from_id: string;
      to_id: string;
      edge_type: EdgeType;
    }
  • src/index.ts:704-729 (registration)
    MCP server registration of the 'memory_unlink' tool with input schema (from_id, to_id, edge_type), annotations, output schema, and handler binding.
    server.registerTool(
      "memory_unlink",
      {
        title: "Remove an edge between two memories",
        description: [
          "Remove a previously created edge — pass the exact `(from_id, to_id, edge_type)` triple used at creation time. No wildcards. Idempotent.",
          "Use to retract incorrect links. To retract a whole memory, prefer `memory_delete` (keeps audit trail).",
        ].join(" "),
        inputSchema: {
          from_id: z.string().min(1).describe("Source memory id of the edge to remove."),
          to_id: z.string().min(1).describe("Target memory id of the edge to remove."),
          edge_type: edgeTypeEnum.describe("Edge type that was used when the edge was created. Must match exactly."),
        },
        annotations: {
          title: "Remove an edge between two memories",
          readOnlyHint: false,
          destructiveHint: true,
          idempotentHint: true,
          openWorldHint: false,
        },
        outputSchema: {
          message: z.string().describe("`Edge removed: <from> -[<edge_type>]-> <to>` on success, or `Edge not found.` when the triple does not exist."),
        },
      },
      async (params) => textResult(await handleMemoryUnlink(edgesRepo, params))
    );
  • Database-level unlink method on EdgesRepo that executes a DELETE query on memory_edges table for the exact (from_id, to_id, edge_type) triple, returning whether any row was deleted.
    unlink(fromId: string, toId: string, type: EdgeType): boolean {
      const result = this.db.prepare(`
        DELETE FROM memory_edges WHERE from_id = ? AND to_id = ? AND edge_type = ?
      `).run(fromId, toId, type);
      return result.changes > 0;
    }
Behavior5/5

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

Discloses idempotence and no-wildcard behavior, adding value beyond annotations. No contradiction with annotations.

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?

Three focused sentences with no filler: purpose, requirement, use case. Front-loaded with key action.

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?

With output schema present and clear alternative tool mentioned, description is fully sufficient for a deletion operation.

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

Parameters4/5

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

Schema coverage is 100%, giving baseline 3. Description adds emphasis on exact match and references the triple format, improving clarity.

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?

Description clearly states the tool removes a previously created edge, specifies the exact triple needed, and distinguishes from memory_delete.

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

Usage Guidelines5/5

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

Explicitly says when to use (retract incorrect links) and when to prefer memory_delete (retracting a whole memory with audit trail).

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/lfrmonteiro99/memento-mcp'

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