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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes |
Implementation Reference
- src/tools/misc.py:30-48 (handler)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)}