Skip to main content
Glama

string_incr

Increase a numerical value stored in a Redis key by a specified or default increment. Simplify data manipulation in Redis MCP for efficient caching, counters, and real-time updates.

Instructions

递增数值

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic of the 'string_incr' tool. It ensures a Redis connection, calls the RedisService.incr method, and returns the result as MCP content.
    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) } ] }; }
  • The input schema definition for the 'string_incr' tool, specifying required 'key' and optional 'increment' parameters.
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' }, increment: { type: 'number', description: '增量值(可选,默认为 1)' } }, required: ['key'] }
  • The tool registration object returned by ListToolsRequestHandler, defining name, description, and inputSchema for 'string_incr'.
    { name: 'string_incr', description: '递增数值', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' }, increment: { type: 'number', description: '增量值(可选,默认为 1)' } }, required: ['key'] } },
  • The dispatch case in the CallToolRequestHandler switch statement that routes 'string_incr' calls to the handler function.
    case 'string_incr': return await this.handleStringIncr(args);

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