Skip to main content
Glama

key_delete

Remove specific keys or key arrays from a Redis database to manage storage and maintain data organization.

Instructions

删除键

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keysYes要删除的键名或键名数组

Implementation Reference

  • MCP tool handler for 'key_delete' that ensures Redis connection, calls RedisService.del with the provided keys, and formats the result as MCP response content.
    private async handleKeyDelete(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.del(args.keys); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
  • Input schema definition for the 'key_delete' tool, specifying keys as string or array of strings.
    name: 'key_delete', description: '删除键', inputSchema: { type: 'object', properties: { keys: { oneOf: [ { type: 'string', description: '键名' }, { type: 'array', items: { type: 'string' }, description: '键名数组' } ], description: '要删除的键名或键名数组' } }, required: ['keys'] }
  • Registration of the 'key_delete' tool handler in the CallToolRequestSchema switch statement.
    case 'key_delete': return await this.handleKeyDelete(args);
  • Supporting method in RedisService that wraps the Redis client's DEL command to delete single or multiple keys.
    async del(key: string | string[]): Promise<RedisOperationResult<number>> { return this.executeCommand(async () => { if (!this.client) throw new Error('Redis client not initialized'); if (Array.isArray(key)) { return await this.client.del(key); } else { return await this.client.del(key); } }); }

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