Function Calling / Tool Use
Function calling (also called tool use) is a capability where the model emits structured JSON requesting that specific tools be called with specific arguments, rather than just generating prose. The runtime executes the tool, returns the result, and feeds it back into the next model turn.
This is how AI agents do things in the world: an agent decides "I need to read a file" → emits {"tool": "read_file", "args": {"path": "..."}} → runtime reads the file → result goes back into the conversation → model continues with that knowledge.
Modern open-weight models with strong function calling: Qwen 2.5/3, Llama 3.1+, Mistral Nemo, Hermes 3 (an explicitly agent-tuned Llama fine-tune). The MCP (Model Context Protocol) standard is consolidating tool definitions across providers — a tool defined for Claude Code can be reused by other MCP-aware agents.
Practical example
A local coding agent needs to check whether a file exists before editing it. With function calling enabled, Qwen 2.5 32B running via an OpenAI-compatible local server emits {"tool": "file_exists", "args": {"path": "src/main.py"}} instead of guessing in prose. The runtime executes the check, returns true, and the model proceeds to the edit step — no hallucinated file paths. Operators running local agents quickly learn that tool-calling reliability varies a lot by model size and fine-tune: an 8B model might call the right tool but format arguments as malformed JSON under load, while a 32B+ model with an explicit agentic fine-tune (like Hermes 3) holds the schema correctly across long multi-turn sessions. If your local agent framework speaks MCP, the same tool definitions work whether you're driving the session from Claude Code or a self-hosted Qwen deployment.
Related terms
See also
Reviewed by Eruo Fredoline. See our editorial policy.