Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.List;

import io.micrometer.common.util.StringUtils;
import io.modelcontextprotocol.client.McpAsyncClient;
import io.modelcontextprotocol.client.McpSyncClient;
import io.modelcontextprotocol.server.McpServerFeatures;
Expand Down Expand Up @@ -58,12 +59,12 @@ private McpToolUtils() {

public static String prefixedToolName(String prefix, String toolName) {

String input = prefix + "-" + toolName;

if (input == null || input.isEmpty()) {
throw new IllegalArgumentException("Input string cannot be null or empty");
if (StringUtils.isEmpty(prefix) || StringUtils.isEmpty(toolName)) {
throw new IllegalArgumentException("Prefix or toolName cannot be null or empty");
}

String input = prefix + "-" + toolName;

// Replace any character that isn't alphanumeric, underscore, or hyphen with
// concatenation
String formatted = input.replaceAll("[^a-zA-Z0-9_-]", "");
Expand Down