xdel
Remove a specific entry from a Redis stream by specifying the stream key and entry ID, ensuring precise data management and cleanup.
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 |
|---|---|---|---|
| entry_id | Yes | ||
| key | Yes |
Implementation Reference
- src/tools/stream.py:54-75 (handler)The 'xdel' tool handler: an async function decorated with @mcp.tool() that deletes a specific entry from a Redis stream using RedisConnectionManager. Returns success or not found message, handles RedisError.@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)}"