xdel
Remove specific entries from Redis streams by providing the stream key and entry ID to manage data efficiently.
Instructions
Delete an entry from a Redis stream.
Args: key (str): The stream key. entry_id (str): The ID of the entry to delete.
Returns: str: Confirmation message or an error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| entry_id | Yes |
Implementation Reference
- src/tools/stream.py:54-74 (handler)The main handler function for the 'xdel' tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function deletes the specified entry from the Redis stream and returns a success message, 'not found' if no entry deleted, or an error message on failure.@mcp.tool() async def xdel(key: str, entry_id: str) -> str: """Delete an entry from a Redis stream. Args: key (str): The stream key. entry_id (str): The ID of the entry to delete. Returns: str: Confirmation message or an error message. """ try: r = RedisConnectionManager.get_connection() result = r.xdel(key, entry_id) return ( f"Successfully deleted entry {entry_id} from {key}" if result else f"Entry {entry_id} not found in {key}" ) except RedisError as e: return f"Error deleting from stream {key}: {str(e)}"