Skip to content

Commit 7ecc709

Browse files
committed
Close all resources
1 parent 8090c58 commit 7ecc709

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mcp/shared/session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ async def send_request(
262262
),
263263
)
264264
)
265+
266+
if isinstance(response_or_error, JSONRPCError):
267+
raise McpError(response_or_error.error)
265268
else:
266-
if isinstance(response_or_error, JSONRPCError):
267-
raise McpError(response_or_error.error)
268-
else:
269-
return result_type.model_validate(response_or_error.result)
269+
return result_type.model_validate(response_or_error.result)
270270

271271
async def send_notification(self, notification: SendNotificationT) -> None:
272272
"""

0 commit comments

Comments
 (0)