Skip to content

Commit fbbbb2f

Browse files
fix: check exception only if done
Task throws exception when it is not done.
1 parent 9232cca commit fbbbb2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/google/adk/tools/mcp_tool/experimental/session_lifecycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def start(self) -> ClientSession:
9191
if self._task.cancelled():
9292
raise ConnectionError('MCP session creation cancelled')
9393

94-
if self._task.exception():
94+
if self._task.done() and self._task.exception():
9595
raise ConnectionError(
9696
f'Failed to create MCP session: {self._task.exception()}'
9797
) from self._task.exception()

0 commit comments

Comments
 (0)