Skip to main content
Glama

hash_set

Set a field-value pair in a Redis hash to store structured data within a key. Use this tool to update or create hash entries for organized data management.

Instructions

设置哈希字段

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes哈希键名
fieldYes字段名
valueYes字段值

Implementation Reference

  • The MCP tool handler for 'hash_set' that ensures Redis connection and executes hset command via RedisService.
    private async handleHashSet(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.hset(args.key, args.field, args.value);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Tool definition in listTools response, including name, description, and input schema for validation.
    {
      name: 'hash_set',
      description: '设置哈希字段',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '哈希键名' },
          field: { type: 'string', description: '字段名' },
          value: { type: 'string', description: '字段值' }
        },
        required: ['key', 'field', 'value']
      }
  • Dispatch case in CallToolRequestSchema handler that routes 'hash_set' calls to the handler function.
    case 'hash_set':
      return await this.handleHashSet(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