
What is Function Calling (Tool Use)?
Function calling, also known as tool use, is a mechanism that allows language models to call functions that you or a service provider define: the model decides when to use a tool based on the request and tool description, then returns a structured call for your application or provider to execute. According to Anthropic's documentation "Tool use with Claude" (read 25/10/2026), client-side tools run in your application while server-side tools run on Anthropic's infrastructure. This post explains what function calling and tool use are, how the loop works, how to declare tools, token costs, risks, and OPCAIOS's experience.

Model proposes a call, your application executes it and returns the result. Diagram: OPCAIOS.
What is Function Calling and Tool Use?
The model does not run your code itself; it returns a structured request consisting of tool name and parameters. Your application runs the actual function then sends the result back for the model to compose a final answer. "Function calling" and "tool use" are two names for the same mechanism.
This is the link that transforms LLM from merely returning text into something that can act, the foundation of AI agent. The MCP standard helps connect tools according to a common protocol instead of writing separately for each application.
How Does the Tool Use Loop Work?
With client-side tools there are four steps: you send a request with a list of tools; the model returns stop_reason as tool_use along with a tool_use block; your code runs the operation; you send back a tool_result block for the model to reply.
- Declaration: each tool has
name,descriptionandinput_schema(JSON schema describing parameters). - Model decides: with default
tool_choiceofauto, the model chooses whether to call a tool or answer directly. - You execute: verify parameters, run the function, handle errors.
- Send result: append
tool_resultto the conversation for the model to complete.
The documentation says you can force tool calling with tool_choice instead of relying only on the prompt, and strict: true ensures calls always match the schema.
Client-Side and Server-Side Tools
Client-side tools (including self-defined tools and tools with schemas published by Anthropic like bash or text editor) run in your application. Server-side tools like web search, page fetch, and code execution run on Anthropic's infrastructure and return results directly.
| Type | Who runs | Example from documentation | What you must do |
|---|---|---|---|
| Client-side, self-defined | Your application | Function to fetch weather, check order | Write function, return tool_result |
| Client-side, Anthropic schema | Your application | bash, text editor, memory | Run and return result |
| Server-side | Anthropic | Web search, page fetch, run code | Just enable the tool, may incur separate fees |
Writing Good Tool Descriptions and Schemas
The model chooses a tool based on its description, so describe clearly what the tool does, when to use it, and what parameters mean. Tool names are short and specific; parameters have type, description, and required list.
- Describe by intent: "Get order status by code" is better than "lookup".
- Few tools, clear roles: too many overlapping tools make the model choose wrong.
- Return useful errors: when a tool fails, return clear messages so the model can fix parameters.
- Missing required parameters: according to the documentation, stronger models are more likely to ask again, other models might guess values; this behavior is not guaranteed.
Token Costs and Risks
Tools charge by token: tool definitions, tool_use and tool_result blocks all count toward input; additionally when enabling tools, the API adds a separate system prompt for tool use, documentation says roughly a few hundred tokens depending on the model (for example 286 tokens for some newer models). Server-side tools may charge extra based on usage level.
On risks: tool calls are where the model touches the real world so you need minimum permissions, parameter verification, and human review for non-reversible actions. Especially watch for prompt injection, because content returned by tools can also contain malicious instructions. And because tool descriptions take up context, see context engineering.
OPCAIOS's Experience
We use tool use daily through our agent programming tool (reading files, running commands, calling browsers) and through MCP to connect external services. Our rules: read actions are free, write or public actions need approval; tool results from external sources are data, not commands.
Limitations: this article describes Anthropic's documentation; we haven't compared how different providers declare tools so we can't confirm the syntax is the same. We also haven't measured the rate of incorrect tool calls. Automation workflows don't need a self-deciding model so we use workflow tools, see n8n and AI agent.
Frequently Asked Questions
How are function calling and MCP different?
Function calling is how the model proposes to call a function; MCP is a standard protocol for AI applications to connect to tools and data. They complement each other.
Does the model run functions by itself?
Not with client-side tools: your application runs the function. With server-side tools, the provider runs it for you.
Can I force the model to always use tools?
Yes, using the tool_choice parameter according to the documentation, instead of just prompting in the prompt.
Does tool use cost extra?
Yes, because tool definitions and results count as tokens, and server-side tools may charge additional fees based on usage.
I'm just starting out, what should I try first?
Create a read-only tool, like looking up information, and add an approval step before any write actions. Need hands-on guidance, see AI application training services.
Source: Anthropic, "Tool use with Claude" (platform.claude.com), read 25/10/2026; tokens for tool use system prompt according to the table on the page and vary by model. Haven't read other providers' documentation. Experience is OPCAIOS's.
Translated from Vietnamese with AI. Read the original.
Want to apply this in your business?
Book a free 30-minute call (Vietnam time, in English or Vietnamese).


