rpop
Remove and return the last element from a Redis list using the specified key, enabling efficient data management in agentic applications.
Instructions
Remove and return the last element from a Redis list.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools/list.py:48-56 (handler)The main handler function for the 'rpop' tool. It connects to Redis, calls r.rpop(name) to remove and return the last element from the list, handles empty lists and Redis errors appropriately.@mcp.tool() async def rpop(name: str) -> str: """Remove and return the last element from a Redis list.""" try: r = RedisConnectionManager.get_connection() value = r.rpop(name) return value if value else f"List '{name}' is empty or does not exist." except RedisError as e: return f"Error popping value from list '{name}': {str(e)}"