Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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)}"

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/redis/mcp-redis'

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