Skip to main content
Glama
farhankaz

Redis MCP Server

by farhankaz

zrem

Remove specific members from a Redis sorted set by specifying the set key and members array. Efficiently manage data with this Redis MCP Server command.

Instructions

Remove one or more members from a sorted set

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesSorted set key
membersYesArray of members to remove

Implementation Reference

  • ZRemTool class implements the 'zrem' tool handler, including name, description, schema, validation, and execute method that calls Redis client.zRem.
    export class ZRemTool extends RedisTool {
      name = 'zrem';
      description = 'Remove one or more members from a sorted set';
      inputSchema = {
        type: 'object',
        properties: {
          key: { type: 'string', description: 'Sorted set key' },
          members: {
            type: 'array',
            description: 'Array of members to remove',
            items: { type: 'string' }
          }
        },
        required: ['key', 'members']
      };
    
      validateArgs(args: unknown): args is ZRemArgs {
        return typeof args === 'object' && args !== null &&
          'key' in args && typeof (args as any).key === 'string' &&
          'members' in args && Array.isArray((args as any).members) &&
          (args as any).members.every((member: any) => typeof member === 'string');
      }
    
      async execute(args: unknown, client: RedisClientType): Promise<ToolResponse> {
        if (!this.validateArgs(args)) {
          return this.createErrorResponse('Invalid arguments for zrem');
        }
    
        try {
          const result = await client.zRem(args.key, args.members);
          return this.createSuccessResponse(`Removed ${result} members from the sorted set`);
        } catch (error) {
          return this.createErrorResponse(`Failed to remove members from sorted set: ${error}`);
        }
      }
    }
  • Type definition for ZRemArgs used in zrem tool validation.
    export interface ZRemArgs {
      key: string;
      members: string[];
    }
  • Instantiation and registration of ZRemTool in the default tools array within ToolRegistry.
    new ZRemTool(),
  • Import of ZRemTool for registration.
    import { ZRemTool } from './zrem_tool.js';
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 ('Remove') but doesn't clarify whether this is destructive, what happens if members don't exist, if it returns a count, or any side effects. For a mutation tool with zero annotation coverage, this is a significant gap.

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 that directly states the tool's function without any fluff or redundancy. It's front-loaded with the core action and resource, 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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., number of members removed), error behaviors, or interaction with other tools, leaving critical gaps for agent usage.

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%, so the schema already documents both parameters ('key' and 'members') adequately. The description adds no additional semantic context beyond what the schema provides, such as format examples or constraints, meeting the baseline for high schema coverage.

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 ('Remove') and target ('one or more members from a sorted set'), which is specific and unambiguous. It doesn't explicitly differentiate from sibling tools like 'del' or 'sadd', but the mention of 'sorted set' provides some implicit distinction.

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 like 'del' (for general keys) or 'sadd' (for set operations). It lacks context about prerequisites, error conditions, or typical use cases, leaving the agent to infer usage from the 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