Skip to main content
Glama

get_memento_statistics

Retrieve database statistics to monitor stored knowledge, track usage patterns, and analyze memory performance for AI assistants.

Instructions

Get statistics about the memento database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function 'handle_get_memento_statistics' implements the tool's logic by retrieving statistics from the memory database and formatting them for the MCP response.
    @handle_tool_errors("get memory statistics")
    async def handle_get_memento_statistics(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle get_memory_statistics tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call (no parameters required)
    
        Returns:
            CallToolResult with formatted statistics or error message
        """
        stats = await memory_db.get_memory_statistics()
    
        # Format statistics
        stats_text = "**Memory Database Statistics**\n\n"
    
        if stats.get("total_memories"):
            stats_text += f"Total Memories: {stats['total_memories']['count']}\n"
    
        if stats.get("memories_by_type"):
            stats_text += "\n**Memories by Type:**\n"
            for mem_type, count in stats["memories_by_type"].items():
                stats_text += f"- {mem_type}: {count}\n"
    
        if stats.get("total_relationships"):
            stats_text += (
                f"\nTotal Relationships: {stats['total_relationships']['count']}\n"
            )
    
        if stats.get("avg_importance"):
            stats_text += (
                f"Average Importance: {stats['avg_importance']['avg_importance']:.2f}\n"
            )
    
        if stats.get("avg_confidence"):
            stats_text += (
                f"Average Confidence: {stats['avg_confidence']['avg_confidence']:.2f}\n"
            )
    
        return CallToolResult(content=[TextContent(type="text", text=stats_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