diff --git a/core/runtime/src/main/java/io/quarkiverse/mcp/server/runtime/FeatureManager.java b/core/runtime/src/main/java/io/quarkiverse/mcp/server/runtime/FeatureManager.java index bb6dae1..bdf423f 100644 --- a/core/runtime/src/main/java/io/quarkiverse/mcp/server/runtime/FeatureManager.java +++ b/core/runtime/src/main/java/io/quarkiverse/mcp/server/runtime/FeatureManager.java @@ -96,7 +96,11 @@ private Object[] prepareArguments(FeatureMethodInfo info, ArgumentProviders argP throw new IllegalStateException(e); } } else { - ret[idx] = val; + if (arg.type() instanceof Class clazz && clazz.isEnum()) { + ret[idx] = Enum.valueOf(clazz, val.toString()); + } else { + ret[idx] = val; + } } } idx++; diff --git a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/McpServerTest.java b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/McpServerTest.java index a443cb1..464867e 100644 --- a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/McpServerTest.java +++ b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/McpServerTest.java @@ -30,7 +30,7 @@ public static QuarkusUnitTest defaultConfig() { // but the test CL can see the class and we don't need Quarkus to analyze this util class QuarkusUnitTest config = new QuarkusUnitTest(); if (System.getProperty("logTraffic") != null) { - config.overrideConfigKey("quarkus.mcp.server.sse.traffic-logging.enabled", "true"); + config.overrideConfigKey("quarkus.mcp.server.traffic-logging.enabled", "true"); } return config; } diff --git a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/MyTools.java b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/MyTools.java index 09b59d5..596f389 100644 --- a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/MyTools.java +++ b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/MyTools.java @@ -4,6 +4,7 @@ import static io.quarkiverse.mcp.server.test.Checks.checkExecutionModel; import static io.quarkiverse.mcp.server.test.Checks.checkRequestContext; +import java.time.DayOfWeek; import java.util.List; import jakarta.inject.Inject; @@ -57,11 +58,11 @@ Uni uni_bravo(int price) { } @Tool - String charlie() { + String charlie(DayOfWeek day) { checkExecutionModel(true); checkDuplicatedContext(); checkRequestContext(); - return "charlie1"; + return DayOfWeek.MONDAY.equals(day) ? "charlie11" : "charlie1"; } @Tool diff --git a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/ToolsTest.java b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/ToolsTest.java index bff1087..103c197 100644 --- a/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/ToolsTest.java +++ b/transports/sse/deployment/src/test/java/io/quarkiverse/mcp/server/test/tools/ToolsTest.java @@ -6,6 +6,7 @@ import java.net.URI; import java.net.URISyntaxException; +import java.time.DayOfWeek; import java.util.function.Consumer; import org.junit.jupiter.api.Test; @@ -72,7 +73,8 @@ public void testTools() throws URISyntaxException { .put("price", 1)); assertToolCall("Hello 1!", endpoint, "uni_bravo", new JsonObject() .put("price", 1)); - assertToolCall("charlie1", endpoint, "charlie", new JsonObject()); + assertToolCall("charlie1", endpoint, "charlie", new JsonObject().put("day", DayOfWeek.FRIDAY.toString())); + assertToolCall("charlie11", endpoint, "charlie", new JsonObject().put("day", DayOfWeek.MONDAY.toString())); assertToolCall("charlie2", endpoint, "uni_charlie", new JsonObject()); assertToolCall("charlie3", endpoint, "list_charlie", new JsonObject()); assertToolCall("charlie4", endpoint, "uni_list_charlie", new JsonObject());