Skip to main content
Glama

hash_set

Store or update field-value pairs in a Redis hash. Manage structured data by specifying a key, field, and value for efficient Redis database operations.

Instructions

设置哈希字段

Input Schema

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

Implementation Reference

  • The main handler function for the 'hash_set' MCP tool. It ensures a Redis connection exists, calls the RedisService.hset method with the provided key, field, and value, and returns the result as MCP content.
    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) } ] }; }
  • Registration of the 'hash_set' tool in the ListTools response handler, including the tool name, description, and input schema definition.
    name: 'hash_set', description: '设置哈希字段', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '哈希键名' }, field: { type: 'string', description: '字段名' }, value: { type: 'string', description: '字段值' } }, required: ['key', 'field', 'value'] } },
  • Input schema definition for the 'hash_set' tool, specifying the required parameters: key, field, and value.
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: '哈希键名' }, field: { type: 'string', description: '字段名' }, value: { type: 'string', description: '字段值' } }, required: ['key', 'field', 'value'] }
  • Dispatch case in the central CallToolRequest handler that routes 'hash_set' calls to the specific handleHashSet method.
    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