lpop
Remove and return the first element from a Redis list using the specified key, enabling efficient data management in Redis MCP Server.
Instructions
Remove and return the first element from a Redis list.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools/list.py:37-45 (handler)The handler function for the 'lpop' tool, decorated with @mcp.tool() for registration. It removes and returns the first element from a Redis list named 'name', handling empty lists and Redis errors.@mcp.tool() async def lpop(name: str) -> str: """Remove and return the first element from a Redis list.""" try: r = RedisConnectionManager.get_connection() value = r.lpop(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)}"