delete
Remove a Redis key using its specified identifier. Returns a confirmation message upon successful deletion or an error message if the operation fails. Ideal for managing data in Redis efficiently.
Instructions
Delete a Redis key.
Args: key (str): The key to delete.
Returns: str: Confirmation message or an error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes |
Implementation Reference
- src/tools/misc.py:12-28 (handler)The handler function for the 'delete' tool, decorated with @mcp.tool(). It deletes the specified Redis key and returns a confirmation or error message.@mcp.tool() async def delete(key: str) -> str: """Delete a Redis key. Args: key (str): The key to delete. Returns: str: Confirmation message or an error message. """ try: r = RedisConnectionManager.get_connection() result = r.delete(key) return f"Successfully deleted {key}" if result else f"Key {key} not found" except RedisError as e: return f"Error deleting key {key}: {str(e)}"