Skip to main content
Glama
farhankaz

Redis MCP Server

by farhankaz

smembers

Retrieve all members from a specific set stored in Redis using the Model Context Protocol (MCP), enabling efficient data management and access for set operations.

Instructions

Get all members in a set

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesSet key

Implementation Reference

  • The execute method implements the smembers tool logic: validates args, calls Redis client.sMembers(key), handles empty set or errors, returns formatted members or messages.
    async execute(args: unknown, client: RedisClientType): Promise<ToolResponse> {
      if (!this.validateArgs(args)) {
        return this.createErrorResponse('Invalid arguments for smembers');
      }
    
      try {
        const members = await client.sMembers(args.key);
        if (members.length === 0) {
          return this.createSuccessResponse('Set is empty or does not exist');
        }
        return this.createSuccessResponse(JSON.stringify(members, null, 2));
      } catch (error) {
        return this.createErrorResponse(`Failed to get set members: ${error}`);
      }
    }
  • Input schema definition for the smembers tool, specifying the required 'key' parameter.
    inputSchema = {
      type: 'object',
      properties: {
        key: { type: 'string', description: 'Set key' }
      },
      required: ['key']
    };
  • TypeScript interface defining the arguments for smembers tool (key: string).
    export interface SMembersArgs {
      key: string;
    }
  • Instantiation and registration of SMembersTool in the default tools array of ToolRegistry.
    new SMembersTool(),
  • Import of SMembersTool for registration in tool registry.
    import { SMembersTool } from './smembers_tool.js';
Behavior2/5

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

No annotations are provided, so the description carries full burden. While 'Get' implies a read operation, it doesn't disclose behavioral traits like whether this returns all members at once (potentially memory-intensive for large sets), error conditions (e.g., if key doesn't exist), or performance characteristics. The description is minimal and lacks operational context.

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, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place without redundancy.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a tool that retrieves data. It doesn't explain what 'members' are (e.g., strings, values), the return format (e.g., list, array), or error handling. For a read operation with minimal structured data, more context is needed to guide the agent effectively.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'key' clearly documented as 'Set key'. The description adds no additional meaning beyond what the schema provides, such as explaining what constitutes a valid key format or examples. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('all members in a set'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'zrange' or 'hgetall' which also retrieve collections, missing an opportunity to clarify this is specifically for Redis set operations.

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. With siblings like 'zrange' (for sorted sets) and 'hgetall' (for hashes), the description doesn't indicate this is for Redis set data structures specifically, leaving the agent to infer usage from the tool name alone.

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

Related 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/farhankaz/redis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server