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(),

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