mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
fix(mcp): assign parsed response once
This commit is contained in:
parent
1cd53a3840
commit
376fd6cdbe
1 changed files with 3 additions and 2 deletions
|
|
@ -3794,14 +3794,15 @@ if MCP_AVAILABLE:
|
|||
) -> _JSONRPCErrorEnvelopeForLogging | None:
|
||||
stripped_body: Final = raw_body.lstrip()
|
||||
if stripped_body.startswith(b"{"):
|
||||
json_body: Final = stripped_body
|
||||
candidate_body = stripped_body
|
||||
else:
|
||||
data_lines: Final = tuple(
|
||||
line.removeprefix(b"data:").lstrip() for line in raw_body.splitlines() if line.startswith(b"data:")
|
||||
)
|
||||
if len(data_lines) != 1:
|
||||
return None
|
||||
json_body = data_lines[0]
|
||||
candidate_body = data_lines[0]
|
||||
json_body: Final = candidate_body
|
||||
try:
|
||||
return _JSONRPC_ERROR_FOR_LOGGING_ADAPTER.validate_json(json_body)
|
||||
except ValidationError:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue