Skip to content

Commit e2852ad

Browse files
committed
make callback async
1 parent a0c4b18 commit e2852ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/mcp/shared/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
class ProgressFnT(Protocol):
4747
"""Protocol for progress notification callbacks."""
4848

49-
def __call__(
49+
async def __call__(
5050
self, progress: float, total: float | None, message: str | None
5151
) -> None: ...
5252

@@ -392,7 +392,7 @@ async def _receive_loop(self) -> None:
392392
# call it with the progress information
393393
if progress_token in self._progress_callbacks:
394394
callback = self._progress_callbacks[progress_token]
395-
callback(
395+
await callback(
396396
notification.root.params.progress,
397397
notification.root.params.total,
398398
notification.root.params.message,

tests/server/fastmcp/test_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ async def call_all_mcp_features(
655655
# Test progress callback functionality
656656
progress_updates = []
657657

658-
def progress_callback(
658+
async def progress_callback(
659659
progress: float, total: float | None, message: str | None
660660
) -> None:
661-
"""Collect progress updates for testing."""
661+
"""Collect progress updates for testing (async version)."""
662662
progress_updates.append((progress, total, message))
663663
print(f"Progress: {progress}/{total} - {message}")
664664

0 commit comments

Comments
 (0)