intermediateTool Calling & Function Calling
What actually happens when an LLM 'calls a tool' — does the model execute code itself?
No — the model only ever outputs structured text saying 'call function X with these arguments.' Your application code intercepts that, actually executes the real function (a database query, an API call), and sends the result back to the model as a new message, which the model then uses to compose its final answer. The model never directly executes anything.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.
What actually happens when an LLM 'calls a tool' — does the model execute code itself?