Skip to main content
Glama

zset_range

Retrieve elements from a Redis sorted set by index range. Specify start and stop positions to get members, optionally with their scores.

Instructions

获取有序集合范围

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes有序集合键名
startYes起始索引
stopYes结束索引
withScoresNo是否返回分数(可选)

Implementation Reference

  • The main execution handler for the 'zset_range' MCP tool. Ensures Redis connection, invokes RedisService.zrange with key, start, stop indices, and optional withScores flag, formats result as JSON text content.
    private async handleZsetRange(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.zrange(args.key, args.start, args.stop, args.withScores); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
  • Input schema definition for the 'zset_range' tool, specifying parameters: key (string), start/stop (numbers), optional withScores (boolean).
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: '有序集合键名' }, start: { type: 'number', description: '起始索引' }, stop: { type: 'number', description: '结束索引' }, withScores: { type: 'boolean', description: '是否返回分数(可选)' } }, required: ['key', 'start', 'stop'] }
  • Dispatch/registration case in the CallToolRequest handler that routes 'zset_range' calls to the handleZsetRange method.
    case 'zset_range': return await this.handleZsetRange(args);
  • Tool registration in ListTools response, including name, description, and input schema for 'zset_range'.
    { name: 'zset_range', description: '获取有序集合范围', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '有序集合键名' }, start: { type: 'number', description: '起始索引' }, stop: { type: 'number', description: '结束索引' }, withScores: { type: 'boolean', description: '是否返回分数(可选)' } }, required: ['key', 'start', 'stop'] } },

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