Skip to main content
Glama

hash_get

Retrieve specific field values from Redis hash data structures using key and field identifiers for targeted data access.

Instructions

获取哈希字段

Input Schema

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

Implementation Reference

  • The main handler function for the 'hash_get' tool. Ensures Redis connection, retrieves the hash field value using redisService.hget(key, field), and returns the result as formatted JSON text content.
    private async handleHashGet(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.hget(args.key, args.field);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • The input schema definition for the 'hash_get' tool, registered in the ListTools response. Requires 'key' and 'field' as strings.
    {
      name: 'hash_get',
      description: '获取哈希字段',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '哈希键名' },
          field: { type: 'string', description: '字段名' }
        },
        required: ['key', 'field']
      }
    },
  • Registration/dispatch in the CallToolRequestSchema handler switch statement, routing calls to the handleHashGet method.
    case 'hash_get':
      return await this.handleHashGet(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