Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

smembers

Retrieve all members from a Redis set by specifying the set key, returning a list of values for data access and management.

Instructions

Get all members of a Redis set.

Args: name: The Redis set key.

Returns: A list of values in the set or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'smembers' MCP tool. It uses RedisConnectionManager to get a connection, calls r.smembers(name) to fetch all members of the set, converts to list if present, or returns an empty message/error.
    @mcp.tool()
    async def smembers(name: str) -> Union[str, List[str]]:
        """Get all members of a Redis set.
    
        Args:
            name: The Redis set key.
    
        Returns:
            A list of values in the set or an error message.
        """
        try:
            r = RedisConnectionManager.get_connection()
            members = r.smembers(name)
            return list(members) if members else f"Set '{name}' is empty or does not exist."
        except RedisError as e:
            return f"Error retrieving members of set '{name}': {str(e)}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions returning 'a list of values in the set or an error message,' which hints at output behavior, but lacks details on performance (e.g., time complexity for large sets), error conditions (e.g., if the key doesn't exist or isn't a set), or side effects. This is a significant gap for a tool with no annotation coverage.

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

Conciseness4/5

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

The description is front-loaded with the core purpose, followed by structured 'Args' and 'Returns' sections, making it efficient and easy to parse. However, the 'Returns' section could be slightly more concise by integrating with the output schema, and there's minor redundancy in formatting.

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) and the presence of an output schema (which likely covers return values), the description is adequate but incomplete. It lacks behavioral details like error handling or performance considerations, which are important for a read operation in a data store context, leaving gaps in overall understanding.

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 adds meaningful context for the single parameter 'name' by specifying it as 'The Redis set key,' which clarifies its purpose beyond the schema's generic 'Name' title. With 0% schema description coverage and only one parameter, this compensation is effective, though it doesn't detail key naming conventions or validation rules.

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 all members') and resource ('of a Redis set'), distinguishing it from sibling tools like 'sadd' (add to set) or 'srem' (remove from set). It precisely communicates the tool's function without ambiguity.

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?

No guidance is provided on when to use this tool versus alternatives. While it's clear this retrieves set members, there's no mention of when to choose it over similar tools like 'scan_keys' for key discovery or 'hgetall' for hash retrieval, nor any prerequisites or context for its application.

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