You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return [
types.TextContent(
type="text",
text=b"This is a test with a problematic character: \x92".decode("windows-1252"),
)
]
Expected behavior
Ideally it should be possible to pass through a value to describe how to handle the error. The TextRecieveStream line that throws the error has a parameter for this already which should be exposed to the user.
Describe the bug
If the server sends a JSON RPC message that contains invalid characters it is possible to crash the client STDOUT reader.
There is no error handling in place for this case, and the default policy throws a traceback which can crash the client application completely.
To Reproduce
I wrote an example client/server that can reproduce the error 100% of the time. Please see https://github.com/SecretiveShell/MCP-SDK-JSON-DECODE-ERROR
The important part is:
Expected behavior
Ideally it should be possible to pass through a value to describe how to handle the error. The
TextRecieveStream
line that throws the error has a parameter for this already which should be exposed to the user.Additional context
I tested a small modification to the code that seems to have mitigated the issue for my application:
Since the erroneous characters are generally punctuation I noticed no impact on performance from just ignoring them.
The text was updated successfully, but these errors were encountered: