Tools & Function Calling
How a model "acts" in the world: file system, web, APIs.
- Understand what a tool is and why it matters
- Recognize the "tool-call → result → continue" loop pattern
- Hear about MCP for the first time and know what it's for
A model without tools is a brain in a jar: it thinks, but it can't do anything. Tools are its hands — functions it can call to read files, search the web, send emails, query databases.
How it actually works
You (or the platform) describe to the model what tools are available, what input each accepts, and what output it returns. When needed, the model "asks" you to call a tool. The platform executes, returns the result. The model continues with the result in context.
USER: "How many active users did we have last week?"
│
▼
MODEL: "I need a tool. Call query_db with ..."
│
▼
PLATFORM: runs query_db → returns { count: 1247 }
│
▼
MODEL: "We had 1247 active users last week."
│
▼
USER: sees the answerTypical tool examples
- read_file / write_file — read or write a local file.
- web_search — search Google/Bing and return results.
- run_code — execute a Python/JS snippet and return the output.
- send_slack — send a message to a channel.
- query_jira — search tickets by filters.
A tool's definition — schema
Each tool is described with a schema: name, description, parameters (with types). The model uses the description to decide IF and WHEN to call the tool.
{
"name": "query_jira",
"description": "Caută tickete în Jira după filtre. Folosește când userul cere status, listă tickete, sau detalii despre cineva.",
"input_schema": {
"type": "object",
"properties": {
"project": { "type": "string", "description": "Cheia proiectului, ex. PROJ" },
"status": { "type": "string", "enum": ["open", "in_progress", "done"] },
"assignee": { "type": "string", "description": "Email-ul asignatului" }
},
"required": ["project"]
}
}MCP — a standard for tools
MCP (Model Context Protocol) is a standard introduced by Anthropic where any tool self-describes its capabilities, and any AI agent can use them without custom code. In practice: you install an "MCP server" for Slack, Google Drive, Linear, etc., and your AI agent automatically learns how to use them.
Your AI model gets the question "what's the ETH price now?". It doesn't have web access by default. What's missing?