The short answer: the model returning a tool_calls array only proves that it requested the tool. It does not prove that your code parsed the call, validated the arguments, executed the function, or sent the result back. In the majority of “the tool never ran” cases, the break is in the application layer—missing message appends, unhandled tool names, swallowed exceptions, or a code path that logs “tool called” without actually calling anything.
I have been burned by this exact gap more than once. The response looked perfect in the debugger. The tool_calls field was populated. My logs even said “tool requested.” Yet the real function had never executed, and the model later answered with invented data. This article walks through the precise places the chain breaks and how to make each step observable.
What This Solves
You see a tool call in the model response, but the side effect or data fetch you expected never happens. By the end of this post you will know:
The exact sequence of application responsibilities after a tool call arrives
The most common places the chain silently stops
Concrete checks and log lines that prove each step occurred
How to distinguish a model problem from an application problem in under a minute
This is core Tool Calling and Structured Output material. Everything later about invalid arguments and recovery assumes you can already prove execution.
Who Should Use This Approach
Developers who have already implemented a basic tool-calling loop and have watched it fail in the real world. If you have not yet walked through a complete request-to-execution example, start with the previous tool-calling article. If you are still deciding whether you need tools at all, the later agent articles will be more relevant.
The Required Application Sequence

After the model returns a completion that contains tool_calls, your code must do all of the following:
Detect the presence of tool_calls (do not rely only on finish_reason).
Append the assistant message that contains the tool calls to the conversation.
For each tool call:
Extract the tool name and the raw arguments string.
Parse the arguments (usually JSON).
Validate the arguments against your expectations.
Execute the real function (or deliberately refuse).
Capture the result or the error.
Append a tool-result message for each tool call, using the correct tool_call_id.
Send the updated message list back to the model for the final answer (or the next tool request).
If any of those steps is missing or fails silently, the function will not have run—even though the model did its part correctly.
Where the Chain Breaks (Real Cases)
1. You inspected the tool call but never executed
Python
if choice.message.tool_calls:
print("tool called:", choice.message.tool_calls[0].function.name)
# ... and then the code just continues or returnsThe log line feels reassuring. The function never ran.
Fix: Put the real function call immediately after validation and log inside the function.
2. You forgot to append the assistant message
Some developers extract the tool call, run the function, and then try to send only the tool result. The API expects the assistant turn that requested the tool to be present in the history.
Symptom: The second request confuses the model or returns an error about message ordering.
Fix: Always append choice.message before appending any tool results.
3. Wrong or missing tool_call_id
The tool-result message must carry the exact id from the tool call. A mismatched or omitted id breaks the association.
Symptom: The model ignores the result or produces a follow-up tool call.
Fix: Copy tool_call.id verbatim into the tool message.
4. Unhandled tool name
The model requested get_current_utc_time but your dispatch only knew about get_time. The code fell through to a default that did nothing or returned a generic error string without ever calling a real function.
Fix: Explicit allow-list. Log unknown tool names as errors.
5. Arguments failed to parse and the exception was swallowed
Python
try:
args = json.loads(tool_call.function.arguments)
except Exception:
pass # or a bare logThe function is never called, and the model never learns that the arguments were unusable.
Fix: Return a clear error string as the tool result so the model can recover or explain.
6. You ran the function but never sent the result back
Execution happened (side effects are visible), yet the model’s final answer does not reflect the real data because the tool-result message was never added.
Symptom: Final content looks like a hallucination even though the tool ran.
Fix: Treat the append of the tool-result message as part of the same atomic step as execution.
7. Early return or exception after detection but before execution
A higher-level try/except or a guard clause exited the handler after printing the tool call but before the function body.
Fix: Keep the detection → validation → execution → append path as linear and short as possible. Log at the beginning and the end of the real function.
Making Every Step Observable
Add a small set of log lines that cannot lie:
Python
print(f"TOOL_REQUEST name={fn_name} id={tool_call.id} raw_args={arguments}")
# after parse + validate
print(f"TOOL_VALIDATE name={fn_name} ok=True args={args}")
# inside the real function
print(f"TOOL_EXECUTE name={fn_name} started")
result = real_function(**args)
print(f"TOOL_EXECUTE name={fn_name} finished result_preview={str(result)[:100]}")
# just before appending
print(f"TOOL_RESULT id={tool_call.id} content_preview={str(result)[:100]}")If any of those lines is missing in the log, you know exactly which step did not happen. This is far more reliable than a single “tool called” message.
Minimal Diagnostic Checklist
When a tool call appears in the response but the expected side effect is absent, ask:
Is there a log line from inside the real function body?
Was the assistant message that contained the tool_calls appended?
Was a tool-result message with the matching tool_call_id appended?
Did argument parsing succeed?
Was the tool name on the allow-list?
Did any exception occur between detection and the final append?
If the answer to the first question is “no,” the function never ran. Everything else is secondary.
A Note from the Home Lab
I once had a status-collecting tool that the model requested correctly every night. My handler logged the tool name, then called a cached fallback because the real network fetch had a transient import error that was being swallowed. The dashboard stayed green. The underlying service was intermittently unreachable. Only when I moved the log statement inside the real fetch function (and made the exception visible as a tool result) did the failures become obvious. The model had been truthful the whole time. The application had been quietly substituting a different answer.
That is the pattern this article exists to prevent.

Practical Checklist
Detection of tool_calls is explicit and happens before any content is treated as final
The assistant tool-call message is always appended
Every tool call produces either a successful tool-result message or a clear error tool-result message
The real function contains its own log or metric that proves execution
Unknown tool names and JSON parse failures are turned into tool results, not silent no-ops
The second (or subsequent) model call is only made after the tool results are in the message list
When a Simpler Approach Is Better
If the task does not require an external action or fresh data, do not introduce a tool. A plain completion is simpler, cheaper, and removes an entire class of “function never ran” bugs. Add tools only when the application must perform work the model cannot do by itself.
Closing
A tool call is a request, not an event. The model can only ask. Your code is responsible for deciding, validating, executing, and reporting back. When the function never runs, the evidence is almost always in the application logs—not in the model’s response.
Make each step visible. Refuse to treat a populated tool_calls array as proof of execution.
Build the full round-trip.
Explain every hand-off between model and application.
Verify that the function body actually ran and that the result was returned.
Build it. Explain it. Verify it.
Next we will look at structured output: how to request schema-constrained replies and why a schema-valid response is still not the same thing as a factually correct one.
Comments
No comments yet — be the first to share a thought.