Skip to main content
Glama

key_expire

Set an expiration time for a Redis key in seconds using this tool. Input the key name and desired duration to manage data lifecycle effectively.

Instructions

设置键过期时间

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名
secondsYes过期时间(秒)

Implementation Reference

  • The handler function that implements the key_expire MCP tool. It ensures Redis connection and calls redisService.expire(key, seconds), returning the result as text content.
    private async handleKeyExpire(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.expire(args.key, args.seconds); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
  • Tool metadata registration in ListTools response, including name, description, and input schema for validation.
    { name: 'key_expire', description: '设置键过期时间', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' }, seconds: { type: 'number', description: '过期时间(秒)' } }, required: ['key', 'seconds'] } },
  • Registration/dispatch case in the CallToolRequestHandler switch statement that routes to the key_expire handler.
    case 'key_expire': return await this.handleKeyExpire(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