Skip to main content
Glama

zset_add

Add members to a sorted set in Redis with specified scores. Use this tool to manage and update sorted sets efficiently, ensuring data is organized by scores for quick retrieval and operations.

Instructions

添加有序集合成员

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes有序集合键名
membersYes要添加的成员或成员数组

Implementation Reference

  • The handler function that executes the zset_add tool by calling RedisService.zadd and returning the result.
    private async handleZsetAdd(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.zadd(args.key, args.members); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
  • The input schema and description for the zset_add tool, registered in listTools response.
    name: 'zset_add', description: '添加有序集合成员', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '有序集合键名' }, members: { oneOf: [ { type: 'object', properties: { member: { type: 'string', description: '成员' }, score: { type: 'number', description: '分数' } }, required: ['member', 'score'], description: '单个成员' }, { type: 'array', items: { type: 'object', properties: { member: { type: 'string', description: '成员' }, score: { type: 'number', description: '分数' } }, required: ['member', 'score'] }, description: '成员数组' } ], description: '要添加的成员或成员数组' } }, required: ['key', 'members'] }
  • Switch case in CallToolRequest handler that dispatches zset_add calls to the handler function.
    case 'zset_add': return await this.handleZsetAdd(args);

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/pickstar-2002/redis-mcp'

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