hash_get
Retrieve specific field values from Redis hash data structures using key and field identifiers for targeted data access.
Instructions
获取哈希字段
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | 哈希键名 | |
| field | Yes | 字段名 |
Implementation Reference
- src/services/mcpService.ts:956-968 (handler)The main handler function for the 'hash_get' tool. Ensures Redis connection, retrieves the hash field value using redisService.hget(key, field), and returns the result as formatted JSON text content.private async handleHashGet(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.hget(args.key, args.field); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:224-235 (schema)The input schema definition for the 'hash_get' tool, registered in the ListTools response. Requires 'key' and 'field' as strings.{ name: 'hash_get', description: '获取哈希字段', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '哈希键名' }, field: { type: 'string', description: '字段名' } }, required: ['key', 'field'] } },
- src/services/mcpService.ts:650-651 (registration)Registration/dispatch in the CallToolRequestSchema handler switch statement, routing calls to the handleHashGet method.case 'hash_get': return await this.handleHashGet(args);