mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-20 15:24:25 +01:00
Apply suggestions from code review
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This commit is contained in:
@@ -59,8 +59,7 @@ async def websocket_client(
|
|||||||
try:
|
try:
|
||||||
async for raw_text in ws:
|
async for raw_text in ws:
|
||||||
try:
|
try:
|
||||||
data = json.loads(raw_text)
|
message = types.JSONRPCMessage.model_validate_json(raw_text)
|
||||||
message = types.JSONRPCMessage.model_validate(data)
|
|
||||||
await read_stream_send.send(message)
|
await read_stream_send.send(message)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
# If JSON parse or model validation fails, send the exception
|
# If JSON parse or model validation fails, send the exception
|
||||||
|
|||||||
Reference in New Issue
Block a user