# Agent protocols: function calling, MCP, A2A and AGENTS.md

Four standards decide how an agent reaches the outside world: function calling inside one model API, MCP for tools and data, A2A for other agents, and AGENTS.md for instructions in a code repository.

## Overview

An agent is only as useful as what it can reach. Early agents hard-coded every tool into the application. Today four layers of standards do that work, and each answers a different question: how does a model ask for a tool, how does an application offer tools from anywhere, how do two agents work together, and how does a coding agent learn the rules of a repository.

A useful picture is an office. Function calling is the way a person fills in a request form. MCP is the standard socket that lets any device plug into the wall. A2A is the phone system that lets two departments hand work to each other. AGENTS.md is the note on the door that tells a visitor how this room works.

## The four layers

| Standard | Question it answers | Who talks to whom | Read more |
|---|---|---|---|
| Function calling | How does a model request an action? | Model → your code, inside one API call | [Function calling](/tools/function-calling) |
| MCP | How does an app offer tools and data from any source? | Agent host → MCP server | [MCP](/tools/mcp) |
| A2A | How does one agent delegate a task to another? | Agent → remote agent | [A2A](/tools/a2a) |
| AGENTS.md | How does a coding agent learn a repository's rules? | Repository → coding agent | [Skills](/tools/skills) |

### Function calling

The model receives a list of tool names, descriptions and argument schemas, and replies with a structured request such as `get_order_status(order_id="A-1002")`. Your code runs the function and returns the result. Nothing runs inside the model. [Structured outputs](/tools/structured-outputs) use the same mechanism to force a reply into a schema.

### MCP: one connector for every host

The Model Context Protocol separates tools from the application that uses them. A team writes a server once (for a database, a ticket system, a file store) and every MCP host can use it: coding agents, chat apps and agent frameworks. Servers expose tools, resources (readable data) and prompts. The 2026-07-28 revision made the core protocol stateless, so servers scale behind ordinary load balancers. Access to private systems goes through [OAuth for tool access](/tools/oauth-for-tool-access).

### A2A: agents as colleagues

Agent2Agent lets an agent find another agent through a published card, send it a task, follow progress and receive results, without knowing how the other agent is built. It suits work that crosses teams or companies, where you cannot merge everything into one framework. A2A has been a project of the Linux Foundation's Agentic AI Foundation since August 2026, alongside MCP.

### AGENTS.md: instructions that live with the code

A plain Markdown file at the root of a repository that tells coding agents how to build, test and style the project. It is the agent equivalent of a contributor guide, and it is also hosted by the Agentic AI Foundation.

## Choosing between them

- **One app, a few tools:** function calling is enough.
- **Tools shared by several apps or teams:** put them behind MCP, so the choice of framework stays reversible.
- **Several agents owned by different teams or vendors:** connect them with A2A rather than one shared codebase.
- **Coding agents on your repository:** add an AGENTS.md before anything else.

The layers combine: an agent can call MCP tools through function calling and hand a sub-task to a remote agent over A2A.

## Security notes

Every layer widens what the agent can do, so every layer needs limits: least-privilege credentials per tool, approval for actions that change data, and treating tool output as untrusted input that may carry [prompt injection](/tools/prompt-injection-defense). See [agent identity and delegation](/tools/agent-identity-and-delegation) and [sandboxing](/tools/sandboxing).

## Learn it hands-on

Run the [ReAct tool-calling simulation](/ai-simulations/react-tool-calling) to watch function calls inside the loop, then read the [MCP](/tools/mcp) and [A2A](/tools/a2a) guides. The [agent frameworks guide](/articles/agentic-ai-frameworks-langchain-langgraph-and-every-alternative) shows which frameworks support each protocol.

## Frequently asked questions

### Is MCP a replacement for function calling?

No. Function calling is how the model asks for a tool; MCP is how the tool is delivered to the application. Most MCP hosts present MCP tools to the model through function calling.

### When do I need A2A instead of MCP?

When the thing you call is itself an agent that plans and works over time, owned by someone else. A tool returns a result; an A2A agent takes on a task.

## Summary

Function calling, MCP, A2A and AGENTS.md form a stack: request, connect, delegate and instruct. Standardising on them keeps tools portable across frameworks and vendors.

## Back to the topic

This page is part of **[Agentic AI](/topics/agentic-ai)**, which maps every concept, tool, simulation and article on the subject.
