Skip to main content
Glama
farhankaz

Redis MCP Server

by farhankaz

del

Delete a specific key from Redis database using the MCP protocol to manage and maintain data efficiently.

Instructions

Delete a key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey to delete

Implementation Reference

  • Handler function that executes the 'del' tool: validates args, calls client.del(key), returns success or error response.
    async execute(args: unknown, client: RedisClientType): Promise<ToolResponse> {
      if (!this.validateArgs(args)) {
        return this.createErrorResponse('Invalid arguments for del');
      }
    
      try {
        const count = await client.del(args.key);
        if (count === 0) {
          return this.createSuccessResponse('Key did not exist');
        }
        return this.createSuccessResponse('Key deleted');
      } catch (error) {
        return this.createErrorResponse(`Failed to delete key: ${error}`);
      }
    }
  • JSON input schema for the 'del' tool defining the required 'key' parameter.
    inputSchema = {
      type: 'object',
      properties: {
        key: { type: 'string', description: 'Key to delete' }
      },
      required: ['key']
    };
  • TypeScript interface DelArgs defining the input arguments for the 'del' tool.
    export interface DelArgs {
      key: string;
    }
  • Instantiation and registration of DelTool instance in the ToolRegistry's default tools array.
    new DelTool(),
  • The registerTool method used to register tools by name in the registry Map.
    registerTool(tool: BaseTool) {
      this.tools.set(tool.name, tool);

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/farhankaz/redis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server