-
Notifications
You must be signed in to change notification settings - Fork 833
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurearea/clientbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersready for workThe goal is clear and work towards it can be commencedThe goal is clear and work towards it can be commenced
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurearea/clientbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersready for workThe goal is clear and work towards it can be commencedThe goal is clear and work towards it can be commenced