stats
Retrieve memory store statistics from the NeverOnce MCP server to monitor data usage and performance metrics.
Instructions
Get memory store statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- neveronce/server.py:173-183 (handler)The MCP tool registration and handler for 'stats'. It fetches stats from the memory object and formats the output string.
@mcp.tool() def stats() -> str: """Get memory store statistics.""" mem = _get_mem() s = mem.stats() return ( f"Total memories: {s['total']}\n" f"Corrections: {s['corrections']}\n" f"Avg importance: {s['avg_importance']:.1f}\n" f"Avg effectiveness: {(s['avg_effectiveness'] or 0):.2f}" ) - neveronce/memory.py:142-144 (helper)Memory class helper method that delegates the stats request to the database layer.
def stats(self) -> dict: """Get memory store statistics.""" return self.db.stats() - neveronce/db.py:208-217 (helper)The actual database query implementation that retrieves statistics from the memories table.
def stats(self) -> dict: row = self.conn.execute( """SELECT COUNT(*) as total, SUM(CASE WHEN memory_type='correction' THEN 1 ELSE 0 END) as corrections, AVG(importance) as avg_importance, AVG(effectiveness) as avg_effectiveness FROM memories""" ).fetchone() return dict(row)