llen
Retrieve the length of a Redis list by specifying its name, enabling efficient data management and size verification for Redis-based applications.
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-85 (handler)The 'llen' tool handler: an async function that connects to Redis and returns the length of the specified list using r.llen(name), with error handling for RedisError.@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)}"
- src/tools/list.py:77-77 (registration)Registration of the 'llen' tool using the @mcp.tool() decorator.@mcp.tool()