Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

get_indexed_keys_number

Retrieve the count of indexed keys for a specific Redis index to monitor indexing status and data volume.

Instructions

Retrieve the number of indexed keys by the index

Args: index_name (str): The name of the index to retrieve information about.

Returns: str: Number of indexed keys as a string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
index_nameYes

Implementation Reference

  • The handler function for the 'get_indexed_keys_number' MCP tool. Decorated with @mcp.tool() for automatic registration. Connects to Redis, performs a full search query on the index to retrieve the total number of documents, and returns it as a string or an error message if the operation fails.
    @mcp.tool() async def get_indexed_keys_number(index_name: str) -> str: """Retrieve the number of indexed keys by the index Args: index_name (str): The name of the index to retrieve information about. Returns: str: Number of indexed keys as a string """ try: r = RedisConnectionManager.get_connection() total = r.ft(index_name).search(Query("*")).total return str(total) except RedisError as e: return f"Error retrieving number of keys: {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