Skip to main content
Glama

hash_set

Set a field-value pair in a Redis hash to store structured data within a key. Use this tool to update or create hash entries for organized data management.

Instructions

设置哈希字段

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes哈希键名
fieldYes字段名
valueYes字段值

Implementation Reference

  • The MCP tool handler for 'hash_set' that ensures Redis connection and executes hset command via RedisService.
    private async handleHashSet(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.hset(args.key, args.field, args.value);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Tool definition in listTools response, including name, description, and input schema for validation.
    {
      name: 'hash_set',
      description: '设置哈希字段',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '哈希键名' },
          field: { type: 'string', description: '字段名' },
          value: { type: 'string', description: '字段值' }
        },
        required: ['key', 'field', 'value']
      }
  • Dispatch case in CallToolRequestSchema handler that routes 'hash_set' calls to the handler function.
    case 'hash_set':
      return await this.handleHashSet(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. '设置哈希字段' implies a write/mutation operation but doesn't disclose any behavioral traits: no information about permissions required, whether the operation is idempotent, what happens if the key doesn't exist (creates new hash?), error conditions, or performance characteristics. The description provides only the most basic functional indication without behavioral context.

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

Conciseness5/5

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

The description is extremely concise at just four Chinese characters. While it's arguably too brief for adequate tool documentation, it contains zero wasted words and is front-loaded with the core function. Every character serves the purpose of stating the tool's basic action, making it maximally efficient within its limited scope.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, what errors might occur, or important behavioral aspects. Given the complexity of a write operation to a Redis hash and the lack of structured metadata, the description should provide more context about the operation's effects and results.

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?

Schema description coverage is 100%, with all three parameters (key, field, value) having clear descriptions in Chinese. The tool description adds no additional parameter semantics beyond what's already in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no parameter information in the description, which applies here.

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

Purpose2/5

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

The description '设置哈希字段' (sets hash field) is a tautology that essentially restates the tool name 'hash_set' in Chinese. It doesn't specify what resource is being modified (Redis hash data structure) or provide any meaningful distinction from sibling tools like hash_mset or string_set. While it indicates a write operation, it lacks specificity about what exactly is being set.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for data manipulation (hash_mset, string_set, set_add, etc.), there's no indication of when hash_set is appropriate versus hash_mset for multiple fields, or when to use hash operations versus string operations. No prerequisites, constraints, or comparison context is provided.

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