Skip to main content
Glama

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
NameRequiredDescriptionDefault
fieldValuesYes字段值对数组
keyYes哈希键名

Implementation Reference

  • 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) } ] }; }
  • 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'] }
  • Dispatch/registration case in the CallToolRequestSchema handler that routes 'hash_mset' calls to the handleHashMset function.
    case 'hash_mset': return await this.handleHashMset(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