list_rpush
Appends one or multiple values to the end of a Redis list, specified by its key. Enables efficient data management and updates in Redis databases for streamlined operations.
Instructions
右侧推入列表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | 列表键名 | |
| values | Yes | 要推入的值或值数组 |
Implementation Reference
- src/services/mcpService.ts:1024-1036 (handler)MCP tool handler for 'list_rpush': validates connection, calls RedisService.rpush(key, values), and formats result as MCP content.private async handleListRpush(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.rpush(args.key, args.values); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:292-312 (schema)Input schema definition for 'list_rpush' tool, specifying key and values (string or array).{ name: 'list_rpush', description: '右侧推入列表', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '列表键名' }, values: { oneOf: [ { type: 'string', description: '值' }, { type: 'array', items: { type: 'string' }, description: '值数组' } ], description: '要推入的值或值数组' } }, required: ['key', 'values'] }
- src/services/mcpService.ts:660-661 (registration)Dispatch case in CallToolRequestSchema handler that routes 'list_rpush' calls to handleListRpush.case 'list_rpush': return await this.handleListRpush(args);
- src/services/redisService.ts:295-305 (helper)RedisService.rpush implementation: handles string or array values, ensures connection, calls underlying Redis client rPush.async rpush(key: string, values: string | string[]): Promise<RedisOperationResult<number>> { return this.executeCommand(async () => { if (!this.client) throw new Error('Redis client not initialized'); if (Array.isArray(values)) { return await this.client.rPush(key, values); } else { return await this.client.rPush(key, values); } }); }