From 706eea6dab0357691a31143247fc928e5cdd9628 Mon Sep 17 00:00:00 2001 From: tucosh Date: Mon, 23 Jun 2025 13:11:07 -0700 Subject: [PATCH] Fix error message in MultiToolAgent.java example The @Schema parameter annotation is missing the parameter name, leading to the following error message: [agents.multitool.MultiToolAgent.main()] ERROR com.google.adk.tools.FunctionTool -- Functions used in tools must have their parameters annotated with @Schema or at least the code must be compiled with the -parameters flag as a fallback. Your function tool will likely not work as expected and exit at runtime. --- .../src/main/java/agents/multitool/MultiToolAgent.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/java/cloud-run/src/main/java/agents/multitool/MultiToolAgent.java b/examples/java/cloud-run/src/main/java/agents/multitool/MultiToolAgent.java index 73292ccdc..6cefd75c2 100644 --- a/examples/java/cloud-run/src/main/java/agents/multitool/MultiToolAgent.java +++ b/examples/java/cloud-run/src/main/java/agents/multitool/MultiToolAgent.java @@ -43,7 +43,8 @@ public static BaseAgent initAgent() { } public static Map getCurrentTime( - @Schema(description = "The name of the city for which to retrieve the current time") + @Schema(name = "city", + description = "The name of the city for which to retrieve the current time") String city) { String normalizedCity = Normalizer.normalize(city, Normalizer.Form.NFD) @@ -76,7 +77,8 @@ public static Map getCurrentTime( } public static Map getWeather( - @Schema(description = "The name of the city for which to retrieve the weather report") + @Schema(name = "city", + description = "The name of the city for which to retrieve the weather report") String city) { if (city.toLowerCase().equals("new york")) { return Map.of( @@ -119,4 +121,4 @@ public static void main(String[] args) throws Exception { } } } -// --8<-- [end:full_code] \ No newline at end of file +// --8<-- [end:full_code]