Skip to content

Chapter 3.5 — Tool use, function calling and MCP

🎯 Objective

Present the most sensitive layer of an agent: real actions on real systems.

🧠 Concepts

  • Tool use — the agent uses an external system to obtain data or execute an action.
  • Function calling — schema-first; the model proposes, the application validates, authorizes and executes.
  • Structured outputs — outputs follow a versioned schema.

🛡️ Mandatory flow

LLM proposes tool_call -> schema validates -> policy authorizes ->
executor calls the system -> result returns to the model ->
final synthesis

🧠 Tool registry

A versioned catalog that stores:

  • name, short description, version;
  • input/output schema;
  • permissions;
  • owner;
  • criticality;
  • status (experimental, active, deprecated, removed);
  • approval policy;
  • rate and cost limits;
  • runbook;
  • changelog.

🧩 MCP (Model Context Protocol)

An open protocol to connect AI applications to tools, resources and prompts via clients and servers. The spec is relatively recent, in active evolution, with growing adoption among providers and SDKs — useful in production, but still consolidating, with non-trivial changes between versions.

MCP helps with:

  • interoperability;
  • discovery;
  • host/server separation;
  • reduction of ad hoc integrations.

MCP does NOT replace:

  • corporate authorization;
  • threat modeling;
  • runtime;
  • eval harness;
  • observability;
  • governance;
  • human approval;
  • business versioning.

Maturity. Treat MCP like any emerging protocol dependency: version pinning, capability review at each upgrade, versioned contracts in the servers you expose, integration regression tests. We return to this point in Ch. 4.9 (supply chain) and Ch. 7.4 (deprecation).

State of the spec (checked on 2026-10-25). The current MCP revision is 2026-07-28 (previous: 2025-11-25); the spec is versioned by the date of the last incompatible change, with a minimum 12-month window for deprecations. The changes that most affect production, by date:

  • 2025-03: the remote transport becomes Streamable HTTP (HTTP+SSE deprecated); tool annotations (read-only/destructive).
  • 2025-06: the server is classified as an OAuth 2.1 resource server and must publish Protected Resource Metadata (RFC 9728); the client must send resource indicators (RFC 8707); structured tool outputs (outputSchema), elicitation and resource links; a normative Security Best Practices page.
  • 2025-11: Client ID Metadata Documents (CIMD) as the recommended registration; experimental tasks; formal governance with working groups.
  • 2026-07: the protocol becomes stateless (no handshake and no session; version and capabilities travel in each request's _meta); new server/discover RPC; server-initiated requests are replaced by multi round-trip requests; Tasks becomes an official extension (outside the core); Roots, Sampling and Logging are deprecated, as is Dynamic Client Registration (RFC 7591) in favor of CIMD; trace-context propagation in _meta (see Ch. 5.3).

The official registry remains in preview (API v0.1 frozen in October 2025; no GA announcement as of the check date). Governance: since 2025-12-09 MCP belongs to the Agentic AI Foundation (AAIF), a directed fund of the Linux Foundation. A2A was announced by Google in April 2025, donated to the Linux Foundation in June 2025, reached version 1.0 in March 2026 (signable Agent Card; JSON-RPC, gRPC and REST bindings) and joined the same foundation in August 2026. Treat both as protocol dependencies: pin the version, review capabilities at each upgrade, treat tool descriptions and annotations as untrusted input, and keep controls outside the protocol (Ch. 4.8, 4.9).

Two file conventions complete this ecosystem and are not protocols: AGENTS.md, free-form Markdown at the repository root (or nested in monorepos) with instructions for coding agents, now governed by the AAIF; and Agent Skills, an open format published in December 2025 in which a folder with a SKILL.md (front matter with name and description, plus scripts/, references/ and assets/) packages portable instructions loaded on demand (the allowed-tools field is still experimental). Both enter the model's context as text: the same supply-chain and untrusted-input rules that apply to tool descriptions apply to them (Ch. 4.3, 4.9).

🤝 A2A (Agent2Agent)

A2A is an open protocol for interoperability between agents (a2a-protocol.org), announced by Google in April 2025 and transferred to the Linux Foundation in June 2025; the 1.0 specification shipped in March 2026 (signable Agent Card; JSON-RPC, gRPC and HTTP/REST bindings) and the project moved to the Agentic AI Foundation in August 2026. Where MCP standardizes the agent↔tool/resource boundary, A2A standardizes the agent↔agent boundary.

Key concepts:

  • Agent Card. A document (JSON) with the remote agent's "spec sheet": declared capabilities, endpoints, supported methods, authentication schemes, execution modes (synchronous, streaming, push). Conceptually analogous to openapi.json for HTTP APIs.
  • Task lifecycle. A2A models exchanges as tasks (tasks) with states (submitted, working, input_required, completed, failed, canceled).
  • Messages and artifacts. Each task carries messages (text/JSON/files) and artifacts as structured deliverables.

A2A does NOT replace:

  • Authorization between agents (it needs OAuth/OIDC, mTLS, JWT, etc.);
  • Agent identity (each agent still needs a strong identity);
  • Threat modeling, audit log, runtime, evals and HITL;
  • Versioning and governance of the capabilities declared in the Agent Card.

Maturity. A2A is an emerging protocol. The 1.0 spec is recent (2026) and publicly named adoption is still scarce; treat it as a consolidating technology, with the same cautious stance as MCP. Adopt it in production with explicit migration windows, controls outside the protocol, and regression tests at each spec release.

Practical differences vs MCP:

Axis MCP A2A
Boundary Agent ↔ tool/resource Agent ↔ agent
Primary unit Tool/resource/prompt Task with messages and artifacts
Discovery Server capabilities Agent Card
Execution state Implicit in the client Explicit task states
Maturity More consolidated Consolidating

🔧 Tool versioning and lifecycle

tool.crm.search_customer@1.4.0
mcp.crm-server@2.1.0
schema.create_ticket@3.0.0
  • Compatible: new optional field, improved description, timeout within the limit.
  • Incompatible: renaming a field, removing a field, changing an enum, altering authorization or a side effect.

🚨 Risks of exposing too many tools

  • Wrong selection.
  • Increased tokens.
  • Indirect prompt injection.
  • Exfiltration.
  • Broad permissions.
  • Latency.
  • Accidental execution.
  • Regressions.

Mitigation: lazy loading — expose tools only after classifying intent and risk.

  • EX-AGT-01 — a simple agent with function calling.
  • EX-AGT-02 — a tool registry with versioning.
  • EX-AGT-03 — a minimal, versioned MCP server.

📚 References