Skip to content

Commit 3e933e4

Browse files
committed
add notes on TODO items for result cache
1 parent 5c03c55 commit 3e933e4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/mcp/server/lowlevel/result_cache.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ class InProgress:
2222

2323

2424
class ResultCache:
25+
"""
26+
Note this class is a work in progress
27+
TODO externalise cachetools to allow for other implementations
28+
e.g. redis etal for production scenarios
29+
TODO properly support join nothing actually happens at the moment
30+
TODO intercept progress notifications from original session and pass to joined
31+
sessions
32+
TODO handle session closure gracefully -
33+
at the moment old connections will hang around and cause problems later
34+
TODO keep_alive logic is not correct as per spec - results are cached for too long,
35+
probably better than too short
36+
TODO needs a lot more testing around edge cases/failure scenarios
37+
"""
38+
2539
_in_progress: dict[types.AsyncToken, InProgress]
2640

2741
def __init__(self, max_size: int, max_keep_alive: int):
@@ -79,7 +93,7 @@ async def join_call(
7993
async with self._lock:
8094
in_progress = self._in_progress.get(req.params.token)
8195
if in_progress is None:
82-
# TODO consider creating new token to allow client
96+
# TODO consider creating new token to allow client
8397
# to get message describing why it wasn't accepted
8498
return types.CallToolAsyncResult(accepted=False)
8599
else:

0 commit comments

Comments
 (0)