Open
Description
Bug description
When I call the tool which name is Chinese, The mcp client will throws Exception below.
Exception in thread "main" io.modelcontextprotocol.spec.McpError: Tool not found: 天���
at io.modelcontextprotocol.spec.McpClientSession.lambda$sendRequest$11(McpClientSession.java:248)
Suppressed: The stacktrace has been enhanced by Reactor, refer to additional information below:
The tool name is messy code.
Environment
Spring AI 1.0.0 , mcp 0.10.0 , without vector store
Java SDK
Openjdk17
Steps to reproduce
Just add a tool with a Chinese name(such as 天气预报), then call the tool.
Recommendation
sendMessage in HttpClientSseClientTransport.java
String jsonText = this.objectMapper.writeValueAsString(message);
URI requestUri = Utils.resolveUri(baseUri, endpoint);
HttpRequest request = this.requestBuilder.uri(requestUri)
.setHeader("Content-Type", "application/json;charset=UTF-8")
.POST(HttpRequest.BodyPublishers.ofString(jsonText))
.build();
So just set the default request encoding of HttpRequest in the HttpClientSseClientTransport to UTF-8.
Metadata
Metadata
Assignees
Labels
No labels