llen
Retrieve the length of a Redis list to monitor data size and manage list operations efficiently.
Instructions
Get the length of a Redis list.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools/list.py:77-84 (handler)The 'llen' tool handler: an async function decorated with @mcp.tool() that connects to Redis via RedisConnectionManager and returns the length of the specified list, or an error message on failure.@mcp.tool() async def llen(name: str) -> int: """Get the length of a Redis list.""" try: r = RedisConnectionManager.get_connection() return r.llen(name) except RedisError as e: return f"Error retrieving length of list '{name}': {str(e)}"