Skip to main content
Glama

get_related_mementos

Find connected memories by exploring relationships like SOLVES or CAUSES to identify solutions or root causes.

Instructions

Find mementos connected to a specific memory via relationships.

Filter by relationship_types (e.g., ["SOLVES"], ["CAUSES"]) and max_depth (default 1).

EXAMPLES:

  • get_related_mementos(memory_id="prob-1", relationship_types=["SOLVES"]) - find solutions

  • get_related_mementos(memory_id="err-1", relationship_types=["CAUSES"], max_depth=2) - find root causes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idYesID of the memory to find relations for
relationship_typesNoFilter by relationship types
max_depthNoMaximum relationship depth to traverse

Implementation Reference

  • The actual handler implementation for 'get_related_mementos', which retrieves related memories from the SQLite database.
    async def handle_get_related_mementos(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle get_related_memories tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - memory_id: ID of memory to find relations for
                - relationship_types: Optional list of relationship types to filter
                - max_depth: Optional maximum traversal depth (default: 2)
    
        Returns:
            CallToolResult with list of related memories or error message
        """
        memory_id = arguments["memory_id"]
        relationship_types = None
    
        if "relationship_types" in arguments:
            relationship_types = [
                RelationshipType(t) for t in arguments["relationship_types"]
            ]
    
        max_depth = arguments.get("max_depth", 2)
    
        related_memories = await memory_db.get_related_memories(
            memory_id=memory_id, relationship_types=relationship_types, max_depth=max_depth
        )
    
        if not related_memories:
            return CallToolResult(
                content=[
                    TextContent(
                        type="text", text=f"No related memories found for: {memory_id}"
                    )
                ]
            )
    
        # Format results
        results_text = f"Found {len(related_memories)} related memories:\n\n"
        for i, (memory, relationship) in enumerate(related_memories, 1):
            results_text += f"**{i}. {memory.title}** (ID: {memory.id})\n"
            results_text += f"Relationship: {relationship.type.value} (strength: {relationship.properties.strength})\n"
            results_text += (
                f"Type: {memory.type.value} | Importance: {memory.importance}\n\n"
            )
    
        return CallToolResult(content=[TextContent(type="text", text=results_text)])
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses default value for max_depth (1) which schema lacks. However, omits safety characteristics (read-only vs destructive), error behavior when memory_id not found, and performance implications of increasing depth.

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?

Excellent structure: one-sentence purpose summary, parameter filter note, then EXAMPLES section. Every sentence earns its place. Front-loaded with clear intent before diving into parameter specifics.

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?

Given 100% schema coverage and clear examples, description is nearly complete. Minor gap: no mention of return value structure (list of mementos) since no output schema exists, though this is somewhat inferable from the tool name and examples.

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 has 100% description coverage (baseline 3). Description adds value by providing concrete enum-like examples for relationship_types (SOLVES, CAUSES) and their semantic meanings ('find solutions', 'find root causes'), plus noting the default depth value.

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?

Clear specific verb ('Find') + resource ('mementos') + mechanism ('via relationships'). Distinguishes from sibling tools like get_memento (single fetch), search_mementos (text search), and create_memento_relationship (mutating operation) by emphasizing graph traversal from a specific starting memory.

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?

Provides concrete EXAMPLES section showing two distinct usage patterns (finding solutions via SOLVES, finding root causes via CAUSES with depth). However, lacks explicit when-not-to-use guidance or comparison to similar traversal tools like search_memento_relationships_by_context.

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