Skip to main content
Glama

hash_del

Remove specific fields from a Redis hash by specifying the key and field names, enabling targeted data cleanup in Redis databases.

Instructions

删除哈希字段

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes哈希键名
fieldsYes要删除的字段名或字段名数组

Implementation Reference

  • The main handler function for the 'hash_del' tool. It ensures Redis connection, calls hdel on RedisService with key and fields, and returns the result as MCP content.
    private async handleHashDel(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.hdel(args.key, args.fields);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Registration of the 'hash_del' tool in the ListTools response, defining name, description, and input schema.
    {
      name: 'hash_del',
      description: '删除哈希字段',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '哈希键名' },
          fields: {
            oneOf: [
              { type: 'string', description: '字段名' },
              { 
                type: 'array', 
                items: { type: 'string' },
                description: '字段名数组'
              }
            ],
            description: '要删除的字段名或字段名数组'
          }
        },
        required: ['key', 'fields']
      }
    },
  • Dispatch case in the main CallToolRequest handler that routes 'hash_del' calls to the specific handleHashDel method.
    case 'hash_del':
      return await this.handleHashDel(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