Skip to main content
Glama

get_low_confidence_mementos

Identify and review potentially obsolete knowledge in the memory system by finding memories with low confidence scores for quality assurance and cleanup.

Instructions

Find memories with low confidence scores.

Use for:

  • Identifying potentially obsolete knowledge

  • Periodic cleanup and verification

  • Quality assurance of the knowledge base

  • Finding memories that need review

Features:

  • Filter by confidence threshold (default: < 0.3)

  • Shows relationships causing low confidence

  • Includes memory details and last access time

  • Sorted by confidence (lowest first)

Returns:

  • List of low confidence relationships with associated memories

  • Memory details for both ends of each relationship

  • Confidence scores and last access times

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thresholdNoConfidence threshold (default: 0.3)
limitNoMaximum number of results (default: 20)

Implementation Reference

  • The implementation of the get_low_confidence_mementos tool handler.
    async def handle_get_low_confidence_mementos(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle get_low_confidence_memories tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - threshold: Confidence threshold (default: 0.3)
                - limit: Maximum number of results to return (default: 20)
    
        Returns:
            CallToolResult with list of low confidence memories or error message
        """
        threshold = float(arguments.get("threshold", 0.3))
        limit = int(arguments.get("limit", 20))
    
        # Get low confidence relationships
        relationships = await memory_db.get_low_confidence_relationships(
            threshold=threshold, limit=limit
        )
    
        if not relationships:
            return CallToolResult(
                content=[
                    TextContent(
                        type="text",
                        text=f"No relationships found with confidence below {threshold}",
                    )
                ]
            )
    
        # Get unique memory IDs from relationships
        memory_ids = set()
    
        for rel in relationships:
            memory_ids.add(rel.from_memory_id)
            memory_ids.add(rel.to_memory_id)
    
        # Fetch memory details
        memories: List[Memory] = []
    
        for memory_id in list(memory_ids)[:limit]:
            try:
                memory = await memory_db.get_memory_by_id(memory_id)
    
                if memory:
                    memories.append(memory)
            except Exception as e:
                logger.warning(f"Failed to fetch memory {memory_id}: {e}")
    
        if not memories:
            return CallToolResult(
                content=[
                    TextContent(
                        type="text",
                        text=f"Found {len(relationships)} low confidence relationships but could not fetch memory details",
                    )
                ]
            )
    
        # Format results
        result_text = f"**Low Confidence Memories (threshold: confidence < {threshold})**\n\n"
        result_text += (
            f"Found {len(memories)} memories with low confidence relationships:\n\n"
        )
    
        for i, memory in enumerate(memories, 1):
            # Find relationships for this memory
            mem_relationships = [
                rel
                for rel in relationships
                if rel.from_memory_id == memory.id or rel.to_memory_id == memory.id
            ]
    
            result_text += f"**{i}. {memory.title}** (ID: {memory.id})\n"
            result_text += f"Type: {memory.type.value} | Importance: {memory.importance:.2f}\n"
    
            if memory.summary:
                result_text += f"Summary: {memory.summary[:150]}...\n"
    
            if mem_relationships:
                result_text += "Low confidence relationships:\n"
    
                for rel in mem_relationships[:3]:
                    other_id = (
                        rel.to_memory_id
                        if rel.from_memory_id == memory.id
                        else rel.from_memory_id
                    )
                    # "Last accessed" refers to the relationship, not the memory
                    last_acc = rel.properties.last_accessed
                    last_acc_str = (
                        last_acc.strftime("%Y-%m-%d")
                        if last_acc
                        else "never accessed via search"
                    )
                    result_text += (
                        f"  - {rel.type.value} → {other_id[:8]}... "
                        f"(relationship confidence: {rel.properties.confidence:.2f}, "
                        f"last accessed: {last_acc_str})\n"
                    )
    
            result_text += "\n"
    
        result_text += "**💡 Suggestions:**\n"
        result_text += "- Review these memories for accuracy\n"
        result_text += "- Use `adjust_memento_confidence` to update if still valid\n"
        result_text += "- Consider deleting if obsolete\n"
        result_text += "- Use `boost_memento_confidence` if recently validated\n"
        result_text += "\n"
        result_text += "â„šī¸ **Note:** 'relationship confidence' is the decay-tracked score on each "
        result_text += "edge — it decreases automatically when the relationship is not accessed. "
        result_text += "'last accessed' tracks when the relationship was last retrieved by a search, "
        result_text += "not when the memory was created.\n"
    
        return CallToolResult(content=[TextContent(type="text", text=result_text)])

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

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