Tool declaration
public class WeatherTool implements Tool {
@Override
public String name() { return "get_weather"; }
@Override
public String description() { return "Get current weather for a city"; }
@Override
public Schema schema() {
return Schema.object()
.property("city", Schema.string().required())
.property("units", Schema.string().enumValues("metric", "imperial"));
}
@Override
public Object call(Map args) {
return fetchWeather((String) args.get("city"));
}
} Advertisement
Translation to Gemini format
The adapter converts ADK's Schema into Gemini's Schema proto. Types, requireds, enums all map cleanly.
Advertisement
Parallel tool calls
Gemini 2.5 supports parallel function calls. If the model returns multiple, ADK dispatches concurrently and feeds results back in a single turn.