Skip to main content
Glama

string_decr

Decrement numeric values stored in Redis keys by a specified amount. Use this tool to reduce counters, track decreasing metrics, or manage decrement operations in Redis databases.

Instructions

递减数值

Input Schema

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

Implementation Reference

  • Registration of the string_decr tool in the listTools response, including name, description, and input schema.
    {
      name: 'string_decr',
      description: '递减数值',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' },
          decrement: { type: 'number', description: '减量值(可选,默认为 1)' }
        },
        required: ['key']
      }
  • The main MCP tool handler function for string_decr. Ensures Redis connection, calls RedisService.decr(key, decrement), and returns the result as formatted JSON text content.
    private async handleStringDecr(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.decr(args.key, args.decrement);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Core helper method in RedisService that performs the actual DECR/DECRBY operation using the Redis client.
    async decr(key: string, decrement: number = 1): Promise<RedisOperationResult<number>> {
      return this.executeCommand(async () => {
        if (!this.client) throw new Error('Redis client not initialized');
        
        if (decrement === 1) {
          return await this.client.decr(key);
        } else {
          return await this.client.decrBy(key, decrement);
        }
      });
    }
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 that decreases a numeric value, but it doesn't specify that this operates on Redis string keys, requires Redis connection (implied by sibling tools), affects atomic decrement behavior, or what happens on errors (e.g., if the key doesn't exist or isn't numeric). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 extremely concise with just two characters ('递减数值'), which is efficient and front-loaded. However, it's arguably under-specified rather than optimally concise, as it lacks necessary context for a mutation tool. Still, it avoids redundancy and wastes no words, earning a high score for brevity.

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 tool's complexity (a mutation operation on Redis strings), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the return value (e.g., the new decremented value), error conditions, or dependencies like Redis connectivity. While the schema covers parameters well, the overall context for safe and correct usage is inadequate.

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 the key name and 'decrement' as the decrement value (optional, default 1). The description adds no additional meaning beyond the schema, such as examples or constraints (e.g., decrement must be numeric). Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but no extra credit is given.

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 '递减数值' (decrement value) is a tautology that essentially restates the tool name 'string_decr' (string decrement). While it indicates the general action of decreasing a value, it doesn't specify what resource is being decremented (a string value in Redis), nor does it distinguish this tool from its sibling 'string_incr' (string increment) beyond the opposite direction. The purpose is vague rather than specific.

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. It doesn't mention prerequisites (e.g., the key must exist in Redis), when not to use it (e.g., for non-numeric strings), or direct alternatives like 'string_incr' for incrementing. Without any context, the agent must infer usage from the tool name and schema alone.

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