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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key to delete |
Implementation Reference
- src/tools/del_tool.ts:21-35 (handler)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}`); } }
- src/tools/del_tool.ts:8-14 (schema)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'] };
- src/interfaces/types.ts:37-39 (schema)TypeScript interface DelArgs defining the input arguments for the 'del' tool.export interface DelArgs { key: string; }
- src/tools/tool_registry.ts:32-32 (registration)Instantiation and registration of DelTool instance in the ToolRegistry's default tools array.new DelTool(),
- src/tools/tool_registry.ts:46-47 (registration)The registerTool method used to register tools by name in the registry Map.registerTool(tool: BaseTool) { this.tools.set(tool.name, tool);