Tools, agents, agentic AI, and MCP — turning a model that answers into one that takes actions, ending with the coding assistants you already use.
This is the multi-page printable view of this section. Click here to print.
Make it act
- 1: Tool & Function Calling
- 2: Agents
- 3: Agentic AI
- 4: MCP (Model Context Protocol)
- 5: AI Coding Assistants
1 - Tool & Function Calling
This is the primitive that turns a text generator into something that can act. Agents, skills, plugins, and MCP are all built on it.
The idea
You give the model a list of tools (functions) it’s allowed to call. When answering would need one, the model doesn’t run it — it returns a structured request to call it, with arguments. Your code runs the function and hands the result back. The model then continues with that result in hand.
The loop
- You send the prompt plus tool definitions.
- The model replies either with an answer, or with a tool call (name + arguments).
- Your code executes the tool and returns the result.
- The model uses the result to answer — or calls another tool. Repeat until done.
sequenceDiagram
participant App as Your app
participant Model
participant Tool
App->>Model: prompt + tool definitions
Model-->>App: tool call (name + args)
App->>Tool: execute
Tool-->>App: result
App->>Model: tool result
Model-->>App: final answerThis request → call → result → continue cycle is exactly what an agent automates.
Defining a tool
A tool is declared with a name, a description (the model uses this to decide when to call it), and an input schema (typed parameters). Clear names and descriptions matter more than anything — they’re how the model picks the right tool.
Key points
- The model never executes anything — it only requests calls; your side runs them and is the security boundary.
- Parallel calls — a model may request several tools at once; return all results together.
- Validate inputs and gate risky actions (see Guardrails); the model’s requested arguments are untrusted.
- Structured output is the sibling idea: constrain the answer to a schema, the same way tool arguments are constrained.
Skills, plugins, and MCP are all ways to supply tools (and context) to a model — the calling mechanism underneath is this.
Strengths & limitations
- Strengths — lets the model act, not just talk; typed, validated inputs; the primitive underneath agents, skills, and MCP.
- Limitations — the model can pick the wrong tool or hallucinate arguments; you own execution and its security; each call is a round-trip, adding latency and cost.
Sources
2 - Agents
What it is
An agent is a foundation model that can plan and take actions to reach a goal, rather than just returning a single response. It decides what to do, calls tools (search, APIs, code, databases), observes the result, and repeats until the task is done.
Core components
flowchart TB
subgraph Agent
LLM[LLM core]
P[Planning]
Mem[Memory]
end
LLM --- P
LLM --- Mem
LLM -->|calls| Tools[Tools]
LLM -->|reads| Know[Knowledge and RAG]- Planning — break a goal into steps and decide what to do next.
- Tool use — call external functions/APIs to act or fetch data.
- Memory — keep track of context across steps (short-term and long-term).
- Reflection — evaluate results and adjust the approach.
The agent loop
A plain chat call is one prompt in, one answer out. An agent instead runs a loop — reason → act → observe — until the goal is reached:
flowchart LR
G[Goal] --> R[Reason]
R --> A[Act - call a tool]
A --> O[Observe result]
O --> R
O --> D[Answer when done]Example — a tool-using turn
Question: “What’s the weather in Paris?”
- Reason — I need current weather; I have a
get_weathertool. - Act — call
get_weather("Paris"). - Observe — the tool returns
18°C, rainy. - Answer — “It’s 18°C and rainy in Paris right now.”
A plain chat call can’t do steps 2–3 — it would just guess.
When to use
- The task needs several steps or external actions (not just text generation).
- The model must fetch fresh data or operate on systems (search, code, APIs).
- Outcomes depend on intermediate results the model can’t know in advance.
How much of the loop to hand over to the model — versus scripting the steps yourself — is its own decision: see Agentic AI.
Strengths & limitations
- Strengths — handles tasks you can’t fully script in advance; acts on fresh data and real systems instead of guessing; composes with everything else in this vault (tools, RAG, memory).
- Limitations — each loop step is a model call, so cost and latency multiply; behavior is less predictable than a fixed workflow, and errors compound across steps — which is why guardrails, stop conditions, and evaluation matter more here than anywhere else.
Sources
- Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models (2022) — arXiv:2210.03629
- Anthropic — Building effective agents
3 - Agentic AI
Agentic describes systems where the model doesn’t just answer — it drives its own multi-step actions toward a goal, deciding what to do next and using tools along the way.
Workflows vs. agents
It’s a spectrum of how much control you hand to the model:
flowchart LR
W[Fixed workflow - you control each step] --- Mix[Model chooses among set steps] --- A[Autonomous agent - model drives the loop]- Workflow — you code the steps; the model fills in blanks (extract, classify, summarize). Predictable and cheap.
- Agent — the model decides the steps at runtime via a reason → act → observe loop. Flexible but harder to predict.
Prefer the leftmost option that solves the problem. Agentic is powerful, not free.
The harness
An agent is a model plus a harness — the scaffolding around it that makes the loop work:
flowchart TB
subgraph Harness[The harness]
Loop[Reason - act - observe loop]
Ctx[Context management]
Tools[Tool execution]
Mem[Memory]
Guard[Guardrails and permissions]
end
Harness --> LLM[LLM]The model is the engine; the harness is the chassis — it runs the loop, manages the context window, executes tool calls, stores memory, and enforces guardrails.
When to go agentic
- ✅ The task is multi-step and hard to fully script in advance.
- ✅ It needs to react to intermediate results (search, then decide, then act).
- ❌ A fixed workflow already solves it — don’t add autonomy you don’t need.
Concretely: a support bot that always looks up the KB and answers is a workflow. One that searches the KB, decides the case is billing-specific, queries the billing system, and escalates to a human when the refund exceeds policy — that’s an agent: each next step depends on what the last one returned.
The trade-off
More autonomy = more capability, but also more cost, more latency, and less predictability. That’s why evaluation and guardrails matter more the more agentic you go.
Sources
- Anthropic — Building effective agents
- Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models (2022) — arXiv:2210.03629
4 - MCP (Model Context Protocol)
MCP (Model Context Protocol) is an open standard for connecting models to external tools and data. Think of it as a common plug: instead of hand-wiring every integration, you connect to MCP servers that expose capabilities in a standard shape.
The problem it solves
Before MCP, every app wired up tools and data sources in its own bespoke way. N apps × M integrations meant rebuilding the same connectors over and over. MCP standardizes the interface so an integration is written once and reused by any MCP-compatible app.
How it fits together
flowchart LR
M[Model] --> Host[MCP client or host]
Host --> S1[GitHub server]
Host --> S2[Database server]
Host --> S3[Filesystem server]- MCP server — exposes capabilities (a GitHub server, a database server, a filesystem server, …).
- MCP client / host — the app or agent that connects to servers and makes their capabilities available to the model.
A server can expose three things:
- Tools — functions the model can call (see Tool & function calling).
- Resources — data/context the model can read (files, records).
- Prompts — reusable prompt templates.
Why it matters to you
- Reuse over rebuild — connect to an existing server instead of writing a connector.
- Portability — the same server works across any MCP-compatible client.
- It’s the backbone of the ecosystem — many “connectors”, “skills”, and “plugins” are MCP servers under the hood.
Building your own server is a Stage 2 topic — see Tooling & frameworks.
Strengths & limitations
- Strengths — an integration is written once and reused by any MCP-compatible app; a growing catalog of ready-made servers; one standard shape (tools, resources, prompts) instead of bespoke glue per app.
- Limitations — every server you connect extends your attack surface: a malicious or compromised server can feed the model instructions or leak what the model sends it (the supply-chain threat in AI security); permissions are often coarser than the task needs — prefer servers with narrow scopes; and the standard is young, so auth and transport details are still maturing.
Sources
5 - AI Coding Assistants
Goal
See this module’s concepts running as one product. An AI coding assistant is the most complete agent most builders touch daily — understanding what’s inside makes you better at using it, and it’s the same architecture you’ll build in Stage 2.
What they are
An AI coding assistant is an agent for software work: an LLM wrapped in a harness that can read and edit your files, run commands, search, and use tools — in your editor, terminal, or as a cloud agent that opens a pull request. Products differ (Claude Code, Codex, Cursor, Copilot, Gemini CLI…), but the shape is always the same: model + harness + tools.
flowchart LR
You[You: a goal] --> A[Coding assistant]
A --> M[LLM + agent loop]
A --> F[Read and edit files]
A --> C[Run commands]
A --> W[Search and web]What’s under the hood
Every one of them is built from the concepts in this stage:
- A foundation model does the reasoning.
- The agent loop runs reason → act → observe.
- Tool & function calling lets it edit files and run commands.
- Context engineering decides what code and history the model sees.
- MCP connects it to external tools and data.
Example — one task through the loop
You say: “the login test is failing — fix it.”
- Act — runs the test suite; observe — one assertion fails on an expired mock token.
- Act — reads the test and the auth module; observe — the token helper hardcodes a date.
- Act — edits the helper to generate a fresh date, re-runs the tests; observe — green.
- Answer — summarizes the change and shows the diff.
No step was scripted — the model chose each action from what it observed. That’s the agent loop, applied to code.
Strengths & limitations
- Strengths — tireless on mechanical, multi-file work; verifies its own changes by running tests and commands; one clear goal plus good context routinely beats hand-typing the change.
- Limitations — quality tracks your input: vague goals or missing context produce confident wrong changes; struggles with implicit knowledge that lives only in your head or your team; long sessions degrade as context fills. You review the diff — it ships nothing on its own.