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
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | 字段名 | |
| key | Yes | 哈希键名 | |
| value | Yes | 字段值 |
Implementation Reference
- src/services/mcpService.ts:922-934 (handler)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) } ] }; }
- src/services/mcpService.ts:189-200 (registration)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'] } },
- src/services/mcpService.ts:191-199 (schema)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'] }
- src/services/mcpService.ts:646-647 (handler)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);