Skip to main content
Glama

key_delete

Remove specific keys or arrays of keys from a Redis database to manage storage efficiently. Supports batch deletions for streamlined data handling in Redis MCP.

Instructions

删除键

Input Schema

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

Implementation Reference

  • Executes the key_delete tool: ensures Redis connection, calls RedisService.del on the keys, formats and returns the result in MCP response format.
    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) } ] }; }
  • Registers the key_delete tool in the MCP listTools response, including name, description, and input schema allowing single key or array of keys.
    { name: 'key_delete', description: '删除键', inputSchema: { type: 'object', properties: { keys: { oneOf: [ { type: 'string', description: '键名' }, { type: 'array', items: { type: 'string' }, description: '键名数组' } ], description: '要删除的键名或键名数组' } }, required: ['keys'] } },
  • Input schema for key_delete tool: requires 'keys' which can be a string or array of strings.
    inputSchema: { type: 'object', properties: { keys: { oneOf: [ { type: 'string', description: '键名' }, { type: 'array', items: { type: 'string' }, description: '键名数组' } ], description: '要删除的键名或键名数组' } }, required: ['keys'] }
  • RedisService.del method: core implementation that calls the Redis client's del command on single or multiple keys, wrapped with connection handling and error management.
    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