Skip to main content
Glama

zset_range

Retrieve specified range of elements from a Redis sorted set by providing the key, start, and stop indices. Optionally include scores for detailed analysis.

Instructions

获取有序集合范围

Input Schema

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

Implementation Reference

  • The handler function that implements the zset_range tool. It ensures Redis connection, calls zrange on RedisService, and returns the JSON-formatted result.
    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) } ] }; }
  • The input schema and tool metadata definition for zset_range, registered in the ListTools response.
    { 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'] } },
  • The switch case that registers and dispatches the zset_range tool call to its handler.
    case 'zset_range': return await this.handleZsetRange(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