dbsize
Check the total number of keys in your Redis database to monitor storage usage and track data volume.
Instructions
Get the number of keys stored in the Redis database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/server_management.py:7-14 (handler)The core handler implementation for the 'dbsize' MCP tool. This async function, decorated with @mcp.tool(), connects to Redis via RedisConnectionManager, calls dbsize() to get the key count, and returns it as an int or an error string on RedisError.@mcp.tool() async def dbsize() -> int: """Get the number of keys stored in the Redis database""" try: r = RedisConnectionManager.get_connection() return r.dbsize() except RedisError as e: return f"Error getting database size: {str(e)}"