This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git

commit f28c7a7167e893c81943a637115dd7ee2fac8f4a
Author: croway <[email protected]>
AuthorDate: Fri Aug 7 09:46:49 2026 +0200

    CAMEL-23382: rename weather tool parameter to city to avoid HTTP Location 
header collision
---
 ai-agent/README.adoc                               |  2 +-
 ai-agent/src/main/java/sample/camel/ToolRoute.java | 20 +++++++++-----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/ai-agent/README.adoc b/ai-agent/README.adoc
index 564f9e6b..2827e0ad 100644
--- a/ai-agent/README.adoc
+++ b/ai-agent/README.adoc
@@ -128,7 +128,7 @@ The example will continue running and watching the `input` 
directory for new doc
 
 
 2025-11-25T17:51:41.445+01:00  INFO 54308 --- [imer://toolChat] toolChatRoute  
                          : Sending question with tool capability to AI: What 
is the weather like in Rome, Italy? Answer with English slang
-2025-11-25T17:51:43.520+01:00  INFO 54308 --- [imer://toolChat] weatherTool    
                          : Weather tool called for location: Rome
+2025-11-25T17:51:43.520+01:00  INFO 54308 --- [imer://toolChat] weatherTool    
                          : Weather tool called for city: Rome
 2025-11-25T17:51:43.739+01:00  INFO 54308 --- [imer://toolChat] weatherTool    
                          : Geocoding result - Latitude: 41.89193, Longitude: 
12.51133
 2025-11-25T17:51:43.858+01:00  INFO 54308 --- [imer://toolChat] weatherTool    
                          : Weather tool response: The weather in  is 12.4 
degrees Celsius with 87% humidity, 100% cloud cover, wind speed 2.9 km/h from 7 
degrees, and 0.2 mm precipitation.
 2025-11-25T17:51:47.786+01:00  INFO 54308 --- [imer://toolChat] toolChatRoute  
                          : AI Response with tool usage: So, Rome's got it 
pretty mild out there right now – about **12.4°C**, feels like a cool breeze 
with that high humidity hanging around at **87%**. No rain in sight (just 
**0.2mm**), and the sky’s practically overcast (**100% cloud cover**) thanks to 
those gentle winds from the north‑west at **7°** – perfect for grabbing an 
espresso outside while you ponde [...]
diff --git a/ai-agent/src/main/java/sample/camel/ToolRoute.java 
b/ai-agent/src/main/java/sample/camel/ToolRoute.java
index cffe803b..1e1b4304 100644
--- a/ai-agent/src/main/java/sample/camel/ToolRoute.java
+++ b/ai-agent/src/main/java/sample/camel/ToolRoute.java
@@ -29,31 +29,29 @@ public class ToolRoute extends RouteBuilder {
     @Override
     public void configure() throws Exception {
         // Define the weather tool that can be called by the AI
-        from("ai-tool:weatherTool?tags=weather&description=Get the current 
weather for a location"
-            + "&parameter.location=string"
-            + "&parameter.location.description=The city, e.g. Rome"
-            + "&parameter.location.required=true")
+        from("ai-tool:weatherTool?tags=weather&description=Get the current 
weather for a city"
+            + "&parameter.city=string"
+            + "&parameter.city.description=The city, e.g. Rome"
+            + "&parameter.city.required=true")
             .routeId("weatherTool")
-            .log("Weather tool called for location: ${header.location}")
+            .log("Weather tool called for city: ${header.city}")
             .to("direct:geocode")
             .log("Geocoding result - Latitude: ${header.latitude}, Longitude: 
${header.longitude}")
             .to("direct:fetchWeather")
             .log("Weather tool response: ${body}");
 
-        // Geocoding route - convert location name to coordinates
+        // Geocoding route - convert city name to coordinates
         from("direct:geocode")
             .routeId("geocodeRoute")
-            .setHeader("savedLocation", simple("${header.location}"))
-            
.toD("https://geocoding-api.open-meteo.com/v1/search?name=${header.location}&count=1&language=en&format=json";)
+            
.toD("https://geocoding-api.open-meteo.com/v1/search?name=${header.city}&count=1&language=en&format=json";)
             .setHeader("latitude", jq(".results[0].latitude"))
-            .setHeader("longitude", jq(".results[0].longitude"))
-            .setHeader("location", simple("${header.savedLocation}"));
+            .setHeader("longitude", jq(".results[0].longitude"));
 
         // Weather fetching route - get current weather for coordinates
         from("direct:fetchWeather")
             .routeId("fetchWeatherRoute")
             
.toD("https://api.open-meteo.com/v1/forecast?latitude=${header.latitude}&longitude=${header.longitude}&current=temperature_2m,weather_code,precipitation,wind_speed_10m,wind_direction_10m,relative_humidity_2m,cloud_cover&temperature_unit=celsius&wind_speed_unit=kmh";)
-            .setBody(simple("The weather in ${header.savedLocation} is 
${jq(.current.temperature_2m)} degrees Celsius with 
${jq(.current.relative_humidity_2m)}% humidity, ${jq(.current.cloud_cover)}% 
cloud cover, wind speed ${jq(.current.wind_speed_10m)} km/h from 
${jq(.current.wind_direction_10m)} degrees, and ${jq(.current.precipitation)} 
mm precipitation."));
+            .setBody(simple("The weather in ${header.city} is 
${jq(.current.temperature_2m)} degrees Celsius with 
${jq(.current.relative_humidity_2m)}% humidity, ${jq(.current.cloud_cover)}% 
cloud cover, wind speed ${jq(.current.wind_speed_10m)} km/h from 
${jq(.current.wind_direction_10m)} degrees, and ${jq(.current.precipitation)} 
mm precipitation."));
 
         // Route that uses AI with function calling
         from("timer:toolChat?repeatCount=1&delay=20000")

Reply via email to