What is function calling (tool use)?
Large language models are trained to predict text, not to fetch live data or change the world. Function calling closes that gap. You describe a set of tools to the model, and when a request needs one, the model stops generating prose and instead emits a structured call, naming the function and filling in its arguments. Your application runs the function, hands the result back, and the model continues its reply grounded in that real output. It is the mechanism that turns a chatbot into an assistant that can actually search, schedule, and act.
How does function calling work?
Function calling works in a loop between the model and your code. The model never runs anything itself; it only requests a call. Your application is always the one that executes the tool and decides what to do with the result, which is also where permissions and safety checks live.
- Declare the tools. You give the model a list of available functions, each with a name, a description of what it does, and a schema of expected parameters (usually JSON Schema).
- The model decides. Reading the user's request, the model judges whether it can answer directly or needs a tool. If a tool fits, it outputs a structured call like search_web with the argument query set to 'EUR USD rate today' instead of plain text.
- Your code executes. Your application validates the arguments, runs the real function (an API call, a database query, a calculation), and captures the result.
- Feed the result back. You return the tool's output to the model as a new message tied to that call.
- The model answers or calls again. With real data in hand, the model writes a natural-language reply, or chains another tool call if the task needs more steps.
A plain example: you ask, 'What's the weather in Lisbon and remind me to pack an umbrella at 7pm.' The model recognises two jobs. It calls a get_weather function with city set to 'Lisbon', reads back that rain is forecast, then calls a set_reminder function with the text and time. Only after both tools return does it write you a single, accurate reply. It never invented the forecast and never silently forgot the reminder.
Why does function calling matter?
Without tools, an LLM is limited to what it learned during training. It cannot tell you today's price, send an email, or read a file you uploaded an hour ago. Function calling removes those limits and, crucially, reduces hallucination: instead of guessing a fact, the model fetches it. The same mechanism lets an assistant take real actions in systems you already use, which is the difference between a clever conversation and a productive one.
- Live, accurate data. Web search, prices, weather and document lookups replace stale memory with current facts plus citations.
- Real actions. Setting reminders, drafting email, creating calendar events and generating files all become possible from a single conversation.
- Grounded answers. Returning a tool result anchors the reply in verifiable output, which is a primary defence against confident-but-wrong responses.
- Composability. Because the model can chain calls, one request can trigger several tools in sequence to complete a multi-step task.
Function calling is also the foundation under newer standards like the Model Context Protocol (MCP), which standardises how tools are described and connected to models. If you understand function calling, you understand the layer that agents, connectors and tool ecosystems are built on top of.
How does MiyoMind use function calling?
Every useful thing MiyoMind does in a chat is function calling underneath. When you ask Miyo to look something up, the model calls a search tool and replies with citations. When you say 'remind me Friday at 9,' it calls a reminder tool that fires across WhatsApp, Telegram, Discord or the web dashboard. Reading a PDF, generating an image, transcribing a voice note, creating and delivering a file, recalling a past conversation, and acting inside connectors like Gmail, Google Calendar, Drive, Notion, Slack, GitHub and Linear are all exposed to the model as tools it can choose to call.
| You ask | Tool the model calls | What comes back |
|---|---|---|
| What's the latest on this topic? | Live web search | A grounded answer with citations |
| Remind me every Monday at 8am | Recurring reminder | A reminder that fires in your chat app |
| Summarise this PDF | Document read and analysis | A summary drawn from the actual file |
| Add this to my calendar | Connector action (Google Calendar) | A real event created via secure OAuth |
How those calls run matters for safety. MiyoMind is built on the open-source OpenClaw agent runtime plus a model router called Hermes and our own orchestration, memory, billing and safety code, using frontier models from OpenAI, Anthropic, Google, xAI and Alibaba. The model proposes a tool call, but execution happens inside MiyoMind's controlled environment. Every paid user gets a dedicated, sandboxed Docker container with no public internet egress, a read-only root filesystem and zero stored API keys; the free tier runs on a shared direct-agent path instead. Connectors and memories are encrypted at rest with AES-256-GCM, and a ten-layer prompt-injection defence with output scrubbing runs on every message. The model decides what to attempt, but your application, not the model, holds the keys and enforces the rules.
Frequently asked questions
What is the difference between function calling and tool use?
They describe the same thing. 'Function calling' is the term OpenAI popularised; 'tool use' is the term Anthropic and others prefer. Both mean a model deciding to invoke an external function with structured arguments and then using the result to answer.
Does the model actually run the function?
No. The model only outputs a structured request naming the function and its arguments. Your application validates and executes the call, then returns the result for the model to use. This separation is what keeps permissions and execution under your control rather than the model's.
How does the model know which tool to call?
You give the model a description and parameter schema for each tool. The model matches the user's intent against those descriptions and picks the best fit, or answers directly if no tool is needed. Clear tool names and descriptions make the model choose more reliably.
Does function calling stop AI from making things up?
It reduces hallucination but does not eliminate it. By fetching real data instead of guessing, the model grounds its answer in verifiable output. The reply can still be wrong if the tool returns bad data or the model misreads the result, so grounding helps most when paired with citations.
Is function calling the same as MCP?
Not quite. Function calling is the underlying model capability. The Model Context Protocol (MCP) is a standard for describing and connecting tools to models in a consistent way. MCP builds on function calling rather than replacing it.
What can MiyoMind do through function calling?
Live web search with citations, one-off and recurring reminders, image generation, voice transcription, document and PDF analysis, file creation and delivery, recall of past chats, and actions inside connectors like Gmail, Google Calendar, Drive, Notion, Slack, GitHub and Linear via secure OAuth, all from one chat.
Related
Meet your new assistant
Already in WhatsApp, Telegram, Discord, and the web. 100 free credits every month — no card required.