
Baeldung · 7 min readAI & machine learning
Intro to Tool Calling in Spring AI 2.0
The article explains how to integrate tool calling into Spring AI 2.0, covering dependency setup, defining annotated tools, configuring default and per‑call tools, and composing advisors to observe and control the tool‑calling loop. It shows how to build a travel assistant that queries weather and books flights, and how to manually approve tool execution.
- Define tools with @Tool and @ToolParam to expose methods to the model.
- Use .defaultTools() for global tools and .tools() per call to add booking logic.
- Implement CallAdvisor with order adjustments to log or observe each tool‑loop iteration.