Skip to main content
Glama

create_memento_relationship

Link two mementos with typed relationships like SOLVES, CAUSES, or ADDRESSES to map connections between problems, solutions, causes, and effects in a knowledge base.

Instructions

Link two mementos with a typed relationship.

Common types: SOLVES (solution→problem), CAUSES (cause→effect), ADDRESSES (fix→error), REQUIRES (dependent→dependency), RELATED_TO (general)

EXAMPLES:

  • create_memento_relationship(from_memory_id="sol-1", to_memory_id="prob-1", relationship_type="SOLVES")

  • create_memento_relationship(from_memory_id="err-1", to_memory_id="fix-1", relationship_type="CAUSES", context="Config error caused timeout")

Optional: strength (0-1), confidence (0-1), context (description)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_memory_idYesID of the source memory
to_memory_idYesID of the target memory
relationship_typeYesType of relationship to create
strengthNoStrength of the relationship (0.0-1.0)
confidenceNoConfidence in the relationship (0.0-1.0)
contextNoContext or description of the relationship

Implementation Reference

  • The handler function `handle_create_memento_relationship` that executes the logic for the "create_memento_relationship" MCP tool. It validates inputs, extracts context, and calls the database to create the relationship.
    async def handle_create_memento_relationship(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle create_relationship tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - from_memory_id: ID of source memory
                - to_memory_id: ID of target memory
                - relationship_type: Type of relationship (SOLVES, CAUSES, etc.)
                - strength: Optional relationship strength (0.0-1.0, default: 0.5)
                - confidence: Optional confidence score (0.0-1.0, default: 0.8)
                - context: Optional natural language description
    
        Returns:
            CallToolResult with relationship ID on success or error message on failure
        """
        # Validate input arguments
        validate_relationship_input(arguments)
    
        # Get user-provided context (natural language)
        user_context = arguments.get("context")
    
        # Auto-extract structure if context provided
        structured_context = None
        if user_context:
            from ..utils.context_extractor import extract_context_structure
    
            structure = extract_context_structure(user_context)
            structured_context = json.dumps(structure)  # Serialize to JSON string
    
        properties = RelationshipProperties(
            strength=arguments.get("strength", 0.5),
            confidence=arguments.get("confidence", 0.8),
            context=structured_context,  # Store JSON string
        )
    
        relationship_id = await memory_db.create_relationship(
            from_memory_id=arguments["from_memory_id"],
            to_memory_id=arguments["to_memory_id"],
            relationship_type=RelationshipType(arguments["relationship_type"]),
            properties=properties,
        )
    
        return CallToolResult(
            content=[
                TextContent(
                    type="text",
                    text=f"Relationship created successfully: {relationship_id}",
                )
            ]
        )
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses important domain-specific behavior (relationship directionality, common semantic types), but omits operational details like idempotency, whether mementos must exist prior to linking, or what constitutes success/failure.

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

Conciseness4/5

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

Well-structured with clear information hierarchy: purpose statement first, followed by relationship taxonomy, concrete examples, and optional parameters. The examples are verbose but earn their place by demonstrating directional semantics that would otherwise be ambiguous.

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

Completeness3/5

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

For a creation tool with no output schema and no annotations, the description adequately covers the semantic domain model but lacks operational completeness. It should ideally disclose whether the operation validates memento existence, if it's idempotent, or what return value indicates success.

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?

Despite 100% schema coverage (baseline 3), the description adds substantial value by enumerating specific relationship type taxonomies (SOLVES, CAUSES, etc.) and providing concrete usage examples that clarify the directional semantics of from_memory_id vs to_memory_id.

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 immediately states the specific action ('Link two mementos') and the resource type ('typed relationship'), clearly distinguishing this creation tool from siblings like store_memento (which creates the mementos themselves) or get_related_mementos (retrieval).

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?

While it lacks explicit 'do not use when' exclusions, the EXAMPLES section and enumerated relationship types (SOLVES, CAUSES, etc.) provide clear contextual guidance on when and how to use the tool, demonstrating semantic patterns like solution→problem directionality.

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

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