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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | 哈希键名 | |
| field | Yes | 字段名 | |
| value | Yes | 字段值 |
Implementation Reference
- src/services/mcpService.ts:922-934 (handler)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) } ] }; }
- src/services/mcpService.ts:188-199 (schema)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'] }
- src/services/mcpService.ts:646-647 (registration)Dispatch case in CallToolRequestSchema handler that routes 'hash_set' calls to the handler function.case 'hash_set': return await this.handleHashSet(args);