What tool calling is
Tool calling (function calling) lets the model request execution of an external function instead of answering directly. The model returns a structured request: function name + arguments. Your code executes the function, sends the result back, and the model continues from there. This is what makes LLMs act instead of just talk.
Tools as JSON Schema, OpenAI-style
Ollama uses the OpenAI tool format for compatibility:
- Each tool has
type: "function"and afunctionobject. functionhasname,description, andparameters(a JSON Schema).- The
descriptionis what the model reads to decide whether to call the tool — write it like a careful one-line docstring.
Not all models support tools
Tool calling depends on the model being trained for it. Reliable families: Qwen 2.5+ / 3 / 3.5, Llama 3.1+, Mistral / Mixtral, Command R, GPT-OSS, Qwen3-Coder. Check capability with ollama show MODEL and look for tools in the capabilities line.