hash_getall
Retrieve all fields and values from a Redis hash by specifying its key. Use this tool to access complete hash data for analysis or processing in Redis operations.
Instructions
获取所有哈希字段
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | 哈希键名 |
Implementation Reference
- src/services/mcpService.ts:973-985 (handler)MCP tool handler for 'hash_getall': ensures Redis connection, retrieves all hash fields using redisService.hgetall(key), and returns the result as JSON-formatted text content.private async handleHashGetall(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.hgetall(args.key); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:236-246 (schema)Input schema definition for the 'hash_getall' tool: requires a 'key' string parameter representing the hash key name.{ name: 'hash_getall', description: '获取所有哈希字段', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '哈希键名' } }, required: ['key'] } },
- src/services/mcpService.ts:652-653 (registration)Switch case registration in CallToolRequestHandler that routes 'hash_getall' calls to the handleHashGetall method.case 'hash_getall': return await this.handleHashGetall(args);
- src/services/redisService.ts:253-258 (helper)Supporting helper method in RedisService that executes the Redis HGETALL command via the client and wraps in executeCommand.async hgetall(key: string): Promise<RedisOperationResult<Record<string, string>>> { return this.executeCommand(async () => { if (!this.client) throw new Error('Redis client not initialized'); return await this.client.hGetAll(key); }); }