AZMX AI

Guide · 2026-05-25 · 12 min read

Function Calling vs MCP — When to Use Each for AI Tools

A clear, opinionated comparison of two dominant paradigms for connecting LLMs to external tools, with real-world trade-offs.

Function calling and MCP (Model Context Protocol) are the two main ways to give AI agents access to tools, but they serve fundamentally different purposes. Function calling is a lightweight, model-native mechanism for structured outputs. MCP is a protocol for defining and exposing entire tool ecosystems. This post breaks down what each one is, how they compare, and when to choose one over the other — with honest takes on their strengths and weaknesses.

If you've built anything with LLMs in the last two years, you've run into the choice: do you use function calling or MCP to let your AI interact with the outside world? Both let agents call tools, but they operate at different layers of abstraction.

What Is Function Calling?

Function calling is a feature built into many LLMs — most notably OpenAI, Anthropic, and Google Gemini — that allows the model to output structured JSON representing a function invocation. You define a schema (usually in JSON Schema), send it alongside the prompt, and the model returns a JSON object like {"function": "get_weather", "arguments": {"location": "London"}}. Your application then executes the function and sends the result back to the model.

Function calling is lean. There's no server, no protocol, no lifecycle — just a contract between the model and your code. It's ideal for simple tool use inside a single application where you control the full stack.

What Is MCP?

MCP (Model Context Protocol) is an open protocol developed by Anthropic that standardizes how AI agents discover, invoke, and manage tools across multiple services. It defines a client-server architecture where an MCP server exposes tools (and resources, prompts) over stdio or HTTP. An MCP client — which could be an IDE, a chat app, or an agent framework — connects to one or more servers and calls tools by name with typed parameters.

MCP solves a problem function calling doesn't: discovery and composition. Instead of hardcoding tool schemas into every prompt, an agent can query an MCP server for its capabilities, then call them dynamically. This is especially powerful in multi-tool environments like IDEs or enterprise platforms where dozens of services need to be orchestrated.

Key Differences

Here's the breakdown in practical terms:

  • Function calling is per-LLM-call: you define schemas inline. MCP is per-server: you define capabilities once, and any agent can discover them.
  • Function calling requires bundling schemas in every prompt — which consumes context tokens. MCP offloads schema definition to the server, reducing token usage for tool metadata.
  • Function calling has no built-in auth, logging, or lifecycle. MCP includes resource management, optional auth, and standardized error handling.
  • Function calling is supported natively by ~15 LLM providers (OpenAI, Anthropic, Google, Groq, DeepSeek, etc.). MCP requires an agent or framework that implements the client side — like AZMX AI, Cline, or Continue.

When to Use Function Calling

Function calling shines when you need a quick, self-contained integration. Consider it when:

  • You have one or two tools used in a single turn (e.g., a chatbot that can look up orders or fetch weather).
  • You control both the application and the LLM backend (e.g., a Shopify app with OpenAI).
  • You want minimal setup — just define a JSON schema, no servers to run.
  • You're prototyping or working on a small project.

For example, GitHub Copilot and Tabnine use function calling to let models access file context, lint results, and git history — all within a single process.

When to Use MCP

MCP is designed for scale, flexibility, and multi-tool environments. Choose MCP when:

  • You have many tools from different sources — a database, a cloud API, a filesystem, a codebase index — and want to add/remove them without changing agent code.
  • You want to reuse tool servers across multiple agents (e.g., the same MCP server for Postgres works in Cline, Claude Code, and AZMX AI).
  • You need access negotiation (e.g., a deny-list blocking SSH keys) or audit logging.
  • You're building a platform where third parties can contribute tools via MCP servers — similar to how VS Code extensions work.

Tools like Cursor, Windsurf, and Sourcegraph Cody are moving toward MCP because it decouples tool development from the agent itself. A team can build a Postgres MCP server once, and all MCP-compatible agents pick it up.

Honest Trade-offs

Function calling is simpler but more brittle. If your tool schemas change, every prompt that includes them must be updated. MCP adds operational complexity: you need to run MCP servers, handle connection lifecycle, and manage server-side state. For a single-function bot, MCP is overkill. For an enterprise with 50 tools, function calling becomes unmaintainable.

There's also a latency difference. Function calling adds no network hop beyond the LLM API call. MCP adds a round-trip to the server (even if local over stdio, it's still IPC). In practice, this is negligible for most use cases, but for high-frequency tool calls (e.g., in an IDE checking file stats every keystroke), function calling can be faster.

Real-World Examples

Function Calling in Action

OpenAI's function calling powers millions of Slack bots, Zapier integrations, and customer support agents. A typical setup: define three functions — get_user, get_order, create_ticket — and include them in every prompt. The model decides when to call them. No servers, no protocol.

MCP in Action

An MCP-based agent (like those in Cline or AZMX AI) starts by connecting to an MCP server that exposes filesystem tools (read, write, list directory), a shell server for running commands, and a database server for querying Postgres. The agent discovers all available tools via the protocol and uses them without the user hardcoding schemas. If you add a new MCP server for Jira tomorrow, the agent picks it up immediately.

What About Frameworks Like LangChain?

LangChain and similar frameworks (e.g., Vercel AI SDK, Semantic Kernel) abstract over function calling and MCP. They let you define tools in a framework-specific syntax and handle the wiring. They don't replace either approach — they wrap them. The underlying mechanism is still either function calling (if you're hitting OpenAI's API directly) or MCP (if you're connecting to an MCP server behind the scenes). If you're already using such a framework, you don't need to choose at the raw protocol level — but understanding the concepts helps when things break.

The Security Angle

Function calling has no built-in security model. If your code passes user input to a function, you must validate it yourself. MCP's protocol includes tool-level permission checks and scoped access. For example, AZMX AI's MCP client uses a deny-list to block tools from accessing .env, .ssh, or files containing credentials — regardless of what the MCP server declares. That's impossible with raw function calling unless you write your own middleware.

Which One Should You Learn?

Both. Function calling is the entry point — every LLM developer should understand how it works. MCP is where the industry is heading for composable, multi-tool agents. If you're building a single app, start with function calling. If you're building a platform or a tool that orchestrates many services, learn MCP.

Tools like Cursor already use MCP for file and shell access. Claude Code uses MCP for project context. AZMX AI supports both: you can use inline function calling for quick tasks or configure MCP servers for deep integrations. The choice isn't either/or — it's about the right layer for the right job.

Summary

  • Function calling: simple, per-call, no infrastructure, good for 1-5 tools in a single app.
  • MCP: scalable, protocol-based, requires servers, good for many tools across multiple agents.
  • Both can coexist in the same system — AZMX AI, Cline, and Continue use function calling for core LLM interactions and MCP for external tool plugins.
  • The trend is toward MCP for platform builders and function calling for app developers.

In 2026, the most effective AI agents don't choose one paradigm — they use both where they fit.

One window. The whole loop.