Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New line breaks the json format and throwing issue #21

Closed
bibekditagtech opened this issue Dec 18, 2024 · 4 comments
Closed

New line breaks the json format and throwing issue #21

bibekditagtech opened this issue Dec 18, 2024 · 4 comments
Milestone

Comments

@bibekditagtech
Copy link

Hello spring team,

I am having issue with complex user query, for simple query it work well. if i try complex query json break to parse.

java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (String)"{"query": "SELECT SUM(rnd_hours) as total_rnd_hours FROM rnds

I have tried to override McpFunctionCallback and call function to sanitize response. howver work on first call but failed during internal call. I m using mcp-server-mysql https://github.com/designcomputer/mysql_mcp_server. I really dont know issue need to be report here or client . so sorry in advance

@tzolov
Copy link
Contributor

tzolov commented Dec 18, 2024

Hi @bibekditagtech,
Maybe here we can try to remove any new lines or other special characters returned from the tool call.
The STDIO transport spec: "Messages are delimited by newlines, and MUST NOT contain embedded newlines."

@tzolov
Copy link
Contributor

tzolov commented Dec 18, 2024

@bibekditagtech this PR (#22 ) escapes the new line characters before sending it to the server's stdin.
However the mcp server would likely have to un-escape those.

This seems a general limitation of the stdio transport. The sse transport won't have such problems.

@tzolov tzolov closed this as completed in 9adcc5b Dec 19, 2024
@bibekditagtech
Copy link
Author

@bibekditagtech this PR (#22 ) escapes the new line characters before sending it to the server's stdin. However the mcp server would likely have to un-escape those.

This seems a general limitation of the stdio transport. The sse transport won't have such problems.

@tzolov when will this be release. I am using 0.2.0-SNAPSHOT which contain old code.

@tzolov
Copy link
Contributor

tzolov commented Dec 20, 2024

@bibekditagtech, the 0.2.0-SNAPSHOT already contains line escaping functionality. However, this represents the limit of what an MCP client can do - the server must be capable of handling the escaped content.
As an alternative, you can use the remote (HTTP/SSE) transport if your server supports it. This transport method doesn't experience the line escaping issue.

@tzolov tzolov added this to the 0.2.0 milestone Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants