Skip to main content
Glama

string_incr

Increment numeric values stored in Redis keys by a specified amount or by default of 1. Use this tool to update counters, scores, or any numerical data in your Redis database.

Instructions

递增数值

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名
incrementNo增量值(可选,默认为 1)

Implementation Reference

  • The main handler function for the 'string_incr' MCP tool. Ensures Redis connection and delegates to RedisService.incr method.
    private async handleStringIncr(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.incr(args.key, args.increment);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Input schema definition and tool registration entry for 'string_incr' in the ListTools handler.
    {
      name: 'string_incr',
      description: '递增数值',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' },
          increment: { type: 'number', description: '增量值(可选,默认为 1)' }
        },
        required: ['key']
      }
    },
  • Dispatch registration in the CallToolRequestSchema handler switch statement.
    case 'string_incr':
      return await this.handleStringIncr(args);
  • Supporting method in RedisService that implements the core Redis increment logic using client.incr or incrBy.
    async incr(key: string, increment: number = 1): Promise<RedisOperationResult<number>> {
      return this.executeCommand(async () => {
        if (!this.client) throw new Error('Redis client not initialized');
        
        if (increment === 1) {
          return await this.client.incr(key);
        } else {
          return await this.client.incrBy(key, increment);
        }
      });
    }
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. '递增数值' implies a mutation operation (incrementing), but it doesn't specify whether this requires write permissions, what happens if the key doesn't exist (e.g., creates it or errors), or if it's atomic/thread-safe. It also doesn't describe the return value (e.g., new value after increment). For a mutation tool with zero annotation coverage, this is a significant gap in 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 with just two characters ('递增数值'), which efficiently conveys the core action. It's front-loaded with no wasted words, making it easy to parse quickly. However, this conciseness comes at the cost of completeness, but for this dimension alone, it's perfectly sized.

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 (a mutation tool with no annotations and no output schema), the description is incomplete. It doesn't explain what the tool increments (e.g., a string value in Redis), behavioral traits like error handling or atomicity, or the return value. With siblings like 'string_decr' and 'string_get', more context is needed to distinguish usage. The description fails to compensate for the lack of structured data, making it inadequate for effective tool selection.

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 clear descriptions for both parameters: 'key' as '键名' (key name) and 'increment' as '增量值(可选,默认为 1)' (increment value, optional, defaults to 1). The description adds no additional 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 documents parameters without extra help from the description.

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 '递增数值' (increment numerical value) states a clear verb ('increment') and resource ('numerical value'), but it's vague about what exactly is being incremented. It doesn't specify this is for string values in a key-value store or distinguish it from sibling tools like 'string_decr' (decrement) or 'string_set' (set value). The purpose is understandable but lacks specificity and sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'string_decr' for decrementing, 'string_set' for setting values directly, or 'string_get' for retrieving values. There's no context about prerequisites (e.g., needing a connected Redis instance) or typical use cases, leaving the agent with no usage direction.

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