diff --git a/mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java b/mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java index c7ab81072ec..502a7e4216e 100644 --- a/mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java +++ b/mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java @@ -79,9 +79,9 @@ public static String prefixedToolName(String prefix, String toolName) { String input = prefix + "_" + toolName; - // Replace any character that isn't alphanumeric, underscore, or hyphen with - // concatenation - String formatted = input.replaceAll("[^a-zA-Z0-9_-]", ""); + // Replace any character that isn't alphanumeric, underscore, hyphen, or Chinese + // characters with empty string + String formatted = input.replaceAll("[^a-zA-Z0-9_\u4e00-\u9fa5]", ""); formatted = formatted.replaceAll("-", "_");