Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

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
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • 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)}"
  • Registration of the 'llen' tool using the @mcp.tool() decorator.
    @mcp.tool()

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