Skip to main content
Glama

memory_link

Establish typed relationships between memories to build a knowledge graph, enabling structured connections like references, implementations, contradictions, and updates.

Instructions

Create an explicit typed link between two memories.

Args: from_id: Source memory ID to_id: Target memory ID edge_type: Type of relationship. Options: - "references" (default): General reference - "implements": Source implements/realizes target - "supersedes": Source replaces/updates target - "extends": Source builds upon target - "contradicts": Source conflicts with target - "related_to": Generic relationship bidirectional: If True, also create reverse link (default: True)

Returns: Dict with created links and their types

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_idYes
to_idYes
edge_typeNoreferences
bidirectionalNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool handler for "memory_link" registered as an MCP tool. It calls the internal _add_link helper.
    async def memory_link(
        from_id: int,
        to_id: int,
        edge_type: str = "references",
        bidirectional: bool = True,
    ) -> Dict[str, Any]:
        """Create an explicit typed link between two memories.
    
        Args:
            from_id: Source memory ID
            to_id: Target memory ID
            edge_type: Type of relationship. Options:
                - "references" (default): General reference
                - "implements": Source implements/realizes target
                - "supersedes": Source replaces/updates target
                - "extends": Source builds upon target
                - "contradicts": Source conflicts with target
                - "related_to": Generic relationship
            bidirectional: If True, also create reverse link (default: True)
    
        Returns:
            Dict with created links and their types
        """
        try:
            result = _add_link(from_id, to_id, edge_type, bidirectional)
            _schedule_cloud_graph_sync()
            return result
        except ValueError as e:
            return {"error": "invalid_input", "message": str(e)}
  • Helper function that wraps the database call for adding a link.
    @_with_connection(writes=True)
    def _add_link(conn, from_id: int, to_id: int, edge_type: str, bidirectional: bool):
        return add_link(conn, from_id, to_id, edge_type, bidirectional)
Behavior3/5

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

No annotations provided, so description carries full burden. It excellently documents bidirectional behavior (creates reverse link when True) and edge type semantics. However, it omits safety traits: idempotency (can links be duplicated?), error handling (behavior if IDs don't exist), and whether this is a destructive mutation.

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?

Uses efficient docstring structure (Args/Returns) with zero wasted words. Critical information (edge type options) is included out of necessity since schema lacks enums. Front-loaded with clear purpose statement.

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

Completeness4/5

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

Comprehensive given complexity: documents all parameters (compensating for empty schema), describes return dict structure, and edge type taxonomy. Minor gap: could reference memory_unlink as the inverse operation among many siblings, but sufficient for correct invocation.

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

Parameters5/5

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

With 0% schema description coverage, the Args section fully compensates by documenting all 4 parameters: from_id/to_id semantics, complete enum values for edge_type with behavioral definitions, and bidirectional logic with default value explanation.

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?

Opens with specific verb 'Create' and clear resource 'explicit typed link between two memories', precisely distinguishing it from siblings like memory_create (creates memories) and memory_unlink (removes links).

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

Usage Guidelines3/5

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

Usage is implied by requiring two memory IDs ('from_id', 'to_id') and stating 'between two memories', indicating it connects existing memories. However, no explicit comparison to siblings (e.g., memory_unlink for removal) or 'when-not-to-use' guidance is provided.

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/agentic-box/memora'

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