hash_mset
Set multiple field-value pairs in a Redis hash at once using batch operations, optimizing database efficiency and reducing latency for Redis MCP server interactions.
Instructions
批量设置哈希字段
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fieldValues | Yes | 字段值对数组 | |
| key | Yes | 哈希键名 |
Implementation Reference
- src/services/mcpService.ts:939-951 (handler)The primary handler function for the 'hash_mset' MCP tool. It ensures a Redis connection, calls RedisService.hmset with the provided key and fieldValues array, and returns the result as formatted JSON text content.private async handleHashMset(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.hmset(args.key, args.fieldValues); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:201-222 (schema)Input schema definition for the 'hash_mset' tool, specifying the required 'key' (string) and 'fieldValues' (array of {field, value} objects).{ name: 'hash_mset', description: '批量设置哈希字段', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '哈希键名' }, fieldValues: { type: 'array', items: { type: 'object', properties: { field: { type: 'string', description: '字段名' }, value: { type: 'string', description: '字段值' } }, required: ['field', 'value'] }, description: '字段值对数组' } }, required: ['key', 'fieldValues'] }
- src/services/mcpService.ts:648-649 (registration)Dispatch/registration case in the CallToolRequestSchema handler that routes 'hash_mset' calls to the handleHashMset function.case 'hash_mset': return await this.handleHashMset(args);