mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-23 16:54:24 +01:00
Avoid double JSON encoding/decoding (#287)
This commit is contained in:
committed by
GitHub
parent
3775916c5c
commit
c8978681f6
@@ -156,11 +156,11 @@ class SseServerTransport:
|
||||
response = Response("Could not find session", status_code=404)
|
||||
return await response(scope, receive, send)
|
||||
|
||||
json = await request.json()
|
||||
logger.debug(f"Received JSON: {json}")
|
||||
body = await request.body()
|
||||
logger.debug(f"Received JSON: {body}")
|
||||
|
||||
try:
|
||||
message = types.JSONRPCMessage.model_validate(json)
|
||||
message = types.JSONRPCMessage.model_validate_json(body)
|
||||
logger.debug(f"Validated client message: {message}")
|
||||
except ValidationError as err:
|
||||
logger.error(f"Failed to parse message: {err}")
|
||||
|
||||
Reference in New Issue
Block a user