Skip to main content
Glama
farhankaz

Redis MCP Server

by farhankaz

sadd

Add one or multiple members to a Redis set using the specified key, enabling efficient data management and organization within the Redis MCP Server.

Instructions

Add one or more members to a set

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesSet key
membersYesMembers to add to the set

Implementation Reference

  • The execute method implements the core logic of the 'sadd' tool, validating arguments and performing the Redis sAdd operation.
    async execute(args: unknown, client: RedisClientType): Promise<ToolResponse> {
      if (!this.validateArgs(args)) {
        return this.createErrorResponse('Invalid arguments for sadd');
      }
    
      try {
        const result = await client.sAdd(args.key, args.members);
        return this.createSuccessResponse(`Added ${result} new member(s) to the set`);
      } catch (error) {
        return this.createErrorResponse(`Failed to add members to set: ${error}`);
      }
    }
  • Input schema definition for the 'sadd' tool, specifying the expected arguments structure.
    inputSchema = {
      type: 'object',
      properties: {
        key: { type: 'string', description: 'Set key' },
        members: {
          type: 'array',
          items: { type: 'string' },
          description: 'Members to add to the set'
        }
      },
      required: ['key', 'members']
    };
  • TypeScript interface defining the SAddArgs used for type-checking the tool inputs.
    export interface SAddArgs {
      key: string;
      members: string[];
    }
  • Instantiation and registration of the SAddTool instance in the default tools array.
    new SAddTool(),
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. It states the action ('Add') but doesn't clarify whether this is an idempotent operation (Redis's SADD adds only new members), what happens on errors, or if there are rate limits or authentication requirements. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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 extremely concise—a single sentence that directly states the tool's function without any fluff. It's front-loaded with the core action and efficiently includes the detail about handling 'one or more members'. Every word earns its place, making it easy to parse quickly.

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 the lack of annotations and output schema, the description is insufficient for a mutation tool like 'sadd'. It doesn't explain return values (e.g., in Redis, SADD returns the number of new members added), error conditions, or side effects. For a tool that modifies data, more context is needed to use it effectively and safely.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('key' as the set key and 'members' as an array of strings to add). The description adds no additional semantic information beyond what the schema already provides, such as format examples or constraints. However, since schema coverage is high, the baseline score of 3 is appropriate.

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 action ('Add') and resource ('members to a set'), making the purpose immediately understandable. It specifies that it can handle 'one or more members', which adds useful detail. However, it doesn't explicitly differentiate from sibling tools like 'zadd' (which adds to sorted sets) or 'set' (which sets a key-value pair), leaving some ambiguity in the Redis context.

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. In a Redis server with multiple set-related tools like 'smembers' (to retrieve set members) and 'zadd' (for sorted sets), there's no indication of when 'sadd' is appropriate versus other options, nor any mention of prerequisites or constraints.

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