Tool calling, also called function calling, is a model's ability to reply with a structured request (a tool name plus JSON arguments) that your program executes, then feed the result back to the model. The model never runs anything itself: it asks, your code acts, and the answer goes back into the conversation. Every coding agent and MCP integration is built on it.
At a glance
What it is
A structured reply: tool name plus JSON arguments, not prose
Who runs the tool
Your program; the model only asks
Where it breaks
Wrong JSON, invented tools, or a server parser that does not match the model
Why it matters here
Every agent lane in a fleet lives or dies by it
Flow
One tool-calling round
The model proposes, your code decides and executes, the result goes back.
1
Modelreplies with a tool name and JSON arguments
2
Your codevalidates the call, runs the tool, captures the result
3
Model againreads the result and answers or calls the next tool
Why does a model need a special format to use tools?
Because your program has to understand the request without guessing. A sentence
like “I would now read the file config.py” is ambiguous; a call with the name
read_file and the argument {"path": "config.py"} is not. Models are trained to
emit that structure when you list tools in the request, and the serving stack
(vLLM, SGLang, an API) extracts it into a tool_calls field. When the model’s
format and the server’s parser disagree, tool calls silently arrive as plain
text and an agent looks broken even though the model is fine.
Why is tool calling a security question?
Because the model decides what to ask for, and anything it reads can try to
steer that decision. A web page or a file can contain instructions aimed at the
model. Your code is the only place that can say no: validate arguments, give each
tool the least power that works, and run agents that execute commands inside a
sandbox, so a bad call cannot reach what the task never needed.