Skip to content

Commit 32b0be6

Browse files
tucoshSita04
andauthored
Fix error message in MultiToolAgent.java example (#441)
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. Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
1 parent 04f31ee commit 32b0be6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/java/cloud-run/src/main/java/agents/multitool/MultiToolAgent.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public static BaseAgent initAgent() {
4343
}
4444

4545
public static Map<String, String> getCurrentTime(
46-
@Schema(description = "The name of the city for which to retrieve the current time")
46+
@Schema(name = "city",
47+
description = "The name of the city for which to retrieve the current time")
4748
String city) {
4849
String normalizedCity =
4950
Normalizer.normalize(city, Normalizer.Form.NFD)
@@ -76,7 +77,8 @@ public static Map<String, String> getCurrentTime(
7677
}
7778

7879
public static Map<String, String> getWeather(
79-
@Schema(description = "The name of the city for which to retrieve the weather report")
80+
@Schema(name = "city",
81+
description = "The name of the city for which to retrieve the weather report")
8082
String city) {
8183
if (city.toLowerCase().equals("new york")) {
8284
return Map.of(
@@ -119,4 +121,4 @@ public static void main(String[] args) throws Exception {
119121
}
120122
}
121123
}
122-
// --8<-- [end:full_code]
124+
// --8<-- [end:full_code]

0 commit comments

Comments
 (0)