Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic function. It doesn't cover critical aspects like error handling (e.g., what happens if the key doesn't exist or isn't a list), performance implications, or return format details (though an output schema exists). For a read operation with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with no wasted words. It front-loads the core purpose ('Get the length of a Redis list') efficiently, making it easy for an agent to parse and understand immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, read-only operation) and the presence of an output schema (which handles return values), the description is minimally adequate. However, it lacks context about error cases and behavioral nuances, which are important for a tool interacting with a data store like Redis.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description implies the parameter is the list's name/key, which aligns with the schema's single 'name' parameter. Since schema description coverage is 0%, the description adds essential meaning by clarifying that 'name' refers to a Redis list. However, it doesn't specify format constraints (e.g., key naming rules), leaving minor gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get the length') and target resource ('a Redis list'), using a precise verb+resource combination. It effectively distinguishes this tool from siblings like 'lrange' (which retrieves list elements) or 'lpop' (which removes elements), making its purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., that the key must exist and be a list type), exclusions (e.g., not for strings or sets), or related tools (like 'type' to check key type first). This leaves the agent without contextual usage cues.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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