string_set
Set string key-value pairs in Redis with optional expiration time to store and manage data efficiently.
Instructions
设置字符串键值
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | 键名 | |
| value | Yes | 值 | |
| expireSeconds | No | 过期时间(秒)(可选) |
Implementation Reference
- src/services/mcpService.ts:820-832 (handler)Handler function that implements the string_set tool logic: ensures Redis connection, calls redisService.set with key, value, expireSeconds, and returns the result as MCP content.private async handleStringSet(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.set(args.key, args.value, args.expireSeconds); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:102-114 (schema)Input schema definition for the string_set tool, including properties for key, value, and optional expireSeconds.{ name: 'string_set', description: '设置字符串键值', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' }, value: { type: 'string', description: '值' }, expireSeconds: { type: 'number', description: '过期时间(秒)(可选)' } }, required: ['key', 'value'] } },
- src/services/mcpService.ts:632-633 (registration)Registration/dispatch in the CallToolRequestSchema handler switch statement that routes string_set calls to the handleStringSet method.case 'string_set': return await this.handleStringSet(args);
- src/services/mcpService.ts:102-114 (registration)Tool registration in the ListToolsRequestSchema response, declaring the string_set tool with its name, description, and schema.{ name: 'string_set', description: '设置字符串键值', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' }, value: { type: 'string', description: '值' }, expireSeconds: { type: 'number', description: '过期时间(秒)(可选)' } }, required: ['key', 'value'] } },