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);
        }
      });
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. '删除键' only states the action without any information about permissions required, whether deletion is permanent, what happens to associated data, error conditions, or response format. For a destructive operation with zero annotation coverage, this is critically insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just two characters ('删除键'), with zero wasted words. It's front-loaded with the core action. While this conciseness comes at the expense of completeness, as a standalone attribute the description is maximally efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive deletion tool with no annotations and no output schema, the description is completely inadequate. It doesn't explain what 'key' refers to in this context (Redis key? Database key?), doesn't mention the permanence of deletion, doesn't describe error handling, and provides no information about return values or side effects. Given the complexity and risk of a deletion operation, this description leaves critical gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'keys' well-documented in the schema as accepting either a string key name or array of key names. The description adds no additional parameter information beyond what's already in the schema. With complete schema coverage, the baseline score of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '删除键' (delete key) is a tautology that essentially restates the tool name 'key_delete' in Chinese. While it does specify the verb 'delete' and resource 'key', it doesn't distinguish this tool from sibling tools like 'key_delete_pattern' or 'hash_del' which also delete keys or hash fields. The purpose is clear at a basic level but lacks differentiation from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are multiple sibling tools that perform deletion operations (key_delete_pattern, hash_del, set_remove, zset_remove, db_flush), but the description doesn't indicate this tool's specific scope or when it's appropriate versus those alternatives. No context, prerequisites, or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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