Skip to main content
Glama

list_lpush

Add one or more values to the beginning of a Redis list, enabling efficient queue management and data prepending operations.

Instructions

左侧推入列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes列表键名
valuesYes要推入的值或值数组

Implementation Reference

  • The handler function that implements the 'list_lpush' MCP tool. It ensures Redis connection, calls redisService.lpush(key, values), and returns the result as formatted text content.
    private async handleListLpush(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.lpush(args.key, args.values);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the 'list_lpush' tool, specifying key (string) and values (string or array of strings).
    inputSchema: {
      type: 'object',
      properties: {
        key: { type: 'string', description: '列表键名' },
        values: {
          oneOf: [
            { type: 'string', description: '值' },
            { 
              type: 'array', 
              items: { type: 'string' },
              description: '值数组'
            }
          ],
          description: '要推入的值或值数组'
        }
      },
      required: ['key', 'values']
    }
  • Registration of the 'list_lpush' tool in the MCP ListTools response, including name, description, and input schema.
    {
      name: 'list_lpush',
      description: '左侧推入列表',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '列表键名' },
          values: {
            oneOf: [
              { type: 'string', description: '值' },
              { 
                type: 'array', 
                items: { type: 'string' },
                description: '值数组'
              }
            ],
            description: '要推入的值或值数组'
          }
        },
        required: ['key', 'values']
      }
    },
  • Dispatch registration in the CallToolRequestSchema switch statement that routes 'list_lpush' calls to the handleListLpush method.
    // List 操作
    case 'list_lpush':
      return await this.handleListLpush(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