Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

type

Check the data type of a value stored at a specific key in Redis to understand how to handle or process it.

Instructions

Returns the string representation of the type of the value stored at key

Args: key (str): The key to check.

Returns: str: The type of key, or none when key doesn't exist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes

Implementation Reference

  • Handler for the 'type' tool: retrieves the Redis data type, TTL, and key info using r.type(key). Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def type(key: str) -> Dict[str, Any]:
        """Returns the string representation of the type of the value stored at key
    
        Args:
            key (str): The key to check.
    
        Returns:
            str: The type of key, or none when key doesn't exist
        """
        try:
            r = RedisConnectionManager.get_connection()
            key_type = r.type(key)
            info = {"key": key, "type": key_type, "ttl": r.ttl(key)}
    
            return info
        except RedisError as e:
            return {"error": 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