Skip to content

Commit cf6acc7

Browse files
committed
Refactor lpush and rpush functions to use FieldT type for value parameter
1 parent c5a483b commit cf6acc7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tools/list.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
from common.connection import RedisConnectionManager
33
from redis.exceptions import RedisError
44
from common.server import mcp
5+
from redis.typing import FieldT
56

67
@mcp.tool()
7-
async def lpush(name: str, value: str, expire: int = None) -> str:
8+
async def lpush(name: str, value: FieldT, expire: int = None) -> str:
89
"""Push a value onto the left of a Redis list and optionally set an expiration time."""
910
try:
1011
r = RedisConnectionManager.get_connection()
@@ -16,7 +17,7 @@ async def lpush(name: str, value: str, expire: int = None) -> str:
1617
return f"Error pushing value to list '{name}': {str(e)}"
1718

1819
@mcp.tool()
19-
async def rpush(name: str, value: str, expire: int = None) -> str:
20+
async def rpush(name: str, value: FieldT, expire: int = None) -> str:
2021
"""Push a value onto the right of a Redis list and optionally set an expiration time."""
2122
try:
2223
r = RedisConnectionManager.get_connection()

0 commit comments

Comments
 (0)