Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyYes哈希键名

Implementation Reference

  • 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)
          }
        ]
      };
    }
  • 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']
      }
    },
  • Switch case registration in CallToolRequestHandler that routes 'hash_getall' calls to the handleHashGetall method.
    case 'hash_getall':
      return await this.handleHashGetall(args);
  • 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);
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('获取所有哈希字段') but doesn't describe return format, error conditions, performance implications, or side effects. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves beyond its basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single phrase ('获取所有哈希字段'), which is concise and front-loaded with the core action. However, it lacks structure and could benefit from additional context to improve clarity without becoming verbose. It earns its place but is minimalistic.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a tool that retrieves all fields from a hash (likely from a data store like Redis, inferred from sibling tools), the description is incomplete. No output schema exists, so the description should explain return values, but it doesn't. With no annotations and minimal description, it fails to provide enough context for effective use, especially compared to richer sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'key' clearly documented as '哈希键名' (hash key name). The description doesn't add any meaning beyond what the schema provides, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the schema adequately handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取所有哈希字段' (Get all hash fields) states the basic action but is vague about scope and format. It mentions the resource (hash fields) but doesn't specify whether this returns keys, values, or both, or how the data is structured. It distinguishes from siblings like hash_get (single field) but not clearly from hash_mset or other hash operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like hash_get (for single fields), hash_mset (for setting multiple), and hash_del (for deletion), the description lacks context on appropriate use cases, prerequisites, or exclusions. It implies usage for retrieving all fields but doesn't specify conditions or limitations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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