rpush
Add a value to the end of a Redis list and optionally configure an expiration time for efficient data management and storage.
Instructions
Push a value onto the right of a Redis list and optionally set an expiration time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expire | No | ||
| name | Yes | ||
| value | Yes |
Implementation Reference
- src/tools/list.py:24-34 (handler)The rpush tool handler function that pushes a value to the right end of a Redis list using RedisConnectionManager, optionally sets an expiration, and returns a success or error message. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() async def rpush(name: str, value: FieldT, expire: Optional[int] = None) -> str: """Push a value onto the right of a Redis list and optionally set an expiration time.""" try: r = RedisConnectionManager.get_connection() r.rpush(name, value) if expire: r.expire(name, expire) return f"Value '{value}' pushed to the right of list '{name}'." except RedisError as e: return f"Error pushing value to list '{name}': {str(e)}"