QVeris
运行任务
QVeris · AI Agent ArchitectureQVeris · AI Agent 架构System Design Guide系统设计指南

Function Calling vs Tool Calling vs MCP函数调用、工具调用与 MCP

A layered architecture guide for AI agents — explaining execution, abstraction, and protocol systems, and how QVeris connects them through capability routing.AI Agent 分层架构指南 — 解释执行层、抽象层和协议系统,以及 QVeris 如何通过能力路由将它们连接起来。

Execution · Abstraction · Protocol · Routing执行 · 抽象 · 协议 · 路由

Execution执行
Layer (Function Calling)层级(函数调用)
Abstraction
Layer (Tool Calling)层级(工具调用)
Protocol协议
Layer (MCP)层级(MCP)
Routing
Layer (QVeris)层级(QVeris)
✓ Multi-layer Agent Model✓ 多层 Agent 模型
TL;DR摘要
Problem: AI agent systems are often described using overlapping terms like function calling, tool calling, and MCP, leading to confusion in architecture design and incorrect system implementation.问题:AI Agent 系统经常使用函数调用、工具调用和 MCP 等重叠术语来描述,导致架构设计混乱和系统实现错误。
Solution: Each concept represents a different layer of the AI agent stack: Function Calling → model-level execution format. Tool Calling → agent-level tool abstraction. MCP → standardized tool protocol layer. QVeris → capability routing layer across tools and MCP systems.解决方案:每个概念代表 AI Agent 栈的不同层次:函数调用 → 模型级执行格式。工具调用 → Agent 级工具抽象。MCP → 标准化工具协议层。QVeris → 跨工具和 MCP 系统的能力路由层。
Result: A clean separation of layers enables scalable, production-grade AI agent systems that can discover, route, and execute tools reliably.结果:清晰的层次分离使可扩展的生产级 AI Agent 系统能够可靠地发现、路由和执行工具。

What is Function Calling?什么是函数调用?

Function Calling is a model-level execution mechanism where the LLM outputs structured JSON arguments instead of natural language text. It answers: "What function should I call and with what parameters?" — defining how the model communicates its intent to invoke a specific function.函数调用是一种模型级执行机制:LLM 输出结构化 JSON 参数,而不是自然语言文本。它回答“应调用哪个函数,以及使用什么参数?”,定义模型如何表达调用特定函数的意图。

Function calling is provided directly by the model API. OpenAI, Anthropic, and Google all implement it — the model receives a list of available function definitions and can respond with a structured JSON object naming the function and providing parsed arguments. The model does not execute the function. It outputs which function to call and what parameters to use. The developer's code is responsible for actually running the function.函数调用由模型 API 直接提供。OpenAI、Anthropic 和 Google 都实现了它 — 模型接收可用函数定义列表,并可以用命名函数和提供解析参数的结构化 JSON 对象响应。模型不执行函数。它输出要调用哪个函数以及使用什么参数。开发者的代码负责实际运行该函数。

Scope: Single call. The model decides to call get_stock_price(symbol="AAPL") and outputs {"name":"get_stock_price","arguments":{"symbol":"AAPL"}}. That is function calling. It does not select between multiple stock price APIs, manage API keys, handle retries, or validate schemas — those are higher-layer concerns.<strong>范围:</strong>单次调用。模型决定调用 <code>get_stock_price(symbol="AAPL")</code> 并输出 <code>{"name":"get_stock_price","arguments":{"symbol":"AAPL"}}</code>。这就是函数调用。它不在多个股票价格 API 之间选择、不管理 API 密钥、不处理重试、不验证 Schema — 这些是更高层的关注点。

What is Tool Calling?什么是工具调用?

Tool Calling is an agent-level abstraction layer that handles tool selection, tool invocation, multi-tool coordination, and execution flow. It answers: "Which tool should the agent use for this task?" — operating one layer above function calling.工具调用是 Agent 级抽象层,负责工具选择、调用、多工具协同和执行流程。它回答“Agent 应为这个任务使用哪个工具?”,位于函数调用之上。

Tool calling sits between the LLM and the actual tool implementation. When an agent has access to 10 different market data tools, tool calling determines which one to invoke — not just the function name and parameters, but which provider, which API, and which execution path. It manages the lifecycle: select → execute → validate → retry → fallback.工具调用位于 LLM 和实际工具实现之间。当 Agent 可以访问 10 个不同的市场数据工具时,工具调用决定调用哪一个 — 不仅仅是函数名称和参数,还包括哪个提供商、哪个 API 和哪个执行路径。它管理生命周期:选择 → 执行 → 验证 → 重试 → 回退。

Scope: Multi-tool. Tool calling orchestrates across multiple tools, providers, and execution attempts. It is the layer that prevents an agent from calling the wrong tool just because its name sounds right.<strong>范围:</strong>多工具。工具调用跨多个工具、提供商和执行尝试进行协调。它是防止 Agent 仅仅因为名称听起来正确就调用错误工具的层。

What is MCP?什么是 MCP?

MCP (Model Context Protocol) is a standardized tool protocol layer. It defines how tools are described, exposed, and connected to AI models and agents — tool schema format, server definition, capability metadata, and execution interface. It answers: "How are tools exposed to AI agents?"MCP(模型上下文协议)是标准化工具协议层,定义工具如何描述、暴露并连接到 AI 模型和 Agent,包括工具 Schema 格式、服务器定义、能力元数据和执行接口。它回答“工具如何暴露给 AI Agent?”

MCP, created by Anthropic, provides a common specification for MCP servers to declare their available tools, resources, and prompts. An MCP server publishes a manifest that any MCP-compatible client can read. This standardization makes tool connectivity predictable — instead of every tool having a custom integration format, MCP-compliant tools share a common language.MCP 由 Anthropic 创建,为 MCP 服务器提供通用规范来声明其可用工具、资源和提示。MCP 服务器发布任何 MCP 兼容客户端都可以读取的清单。这种标准化使工具连接具有可预测性 — 每个工具不再有自定义集成格式,MCP 兼容的工具共享一种通用语言。

Scope: Ecosystem. MCP standardizes tool exposure across the industry. It does not select which tool to use, manage retries, or route across providers. MCP makes tools easier to connect. Higher layers make them easier to select and execute reliably.<strong>范围:</strong>生态系统。MCP 标准化了整个行业的工具暴露。它不选择使用哪个工具、不管理重试、不跨提供商路由。MCP 使工具更容易连接。更高的层使它们更容易选择和可靠执行。

Layered Architecture Model分层架构模型

Layer 1 Function Calling — Execution第 1 层 函数调用 — 执行

The model outputs structured JSON naming a function and its parameters. Answers: "What function should I call and with what arguments?" Operates at the model level. Provided by OpenAI, Anthropic, Google.模型输出结构化 JSON,指定函数名称及参数。它回答“应调用哪个函数、使用哪些参数?”,运行在模型层,由 OpenAI、Anthropic 和 Google 等提供。

Layer 2 Tool Calling — Abstraction第 2 层 工具调用 — 抽象

The agent layer handles tool selection, invocation, multi-tool coordination, retries, and execution flow. Answers: "Which tool should the agent use for this task?" Operates at the agent level.Agent 层负责工具选择、调用、多工具协同、重试和执行流程。它回答“Agent 应为这个任务使用哪个工具?”,运行在 Agent 层。

Layer 3 MCP — Protocol第 3 层 MCP — 协议

A standardized specification for how tools are described, exposed, and connected. Answers: "How are tools exposed to AI agents?" Operates at the ecosystem level. Created by Anthropic.这是一套规范工具如何描述、暴露和连接的标准。它回答“工具如何暴露给 AI Agent?”,运行在生态层,由 Anthropic 创建。

Layer 4 QVeris — Routing第 4 层 QVeris — 路由

A capability routing layer that helps agents discover tools by task intent, inspect schemas before calling, and route across multiple providers. Answers: "Which capability is best for this task?" Operates across the stack.能力路由层帮助 Agent 按任务意图发现工具、调用前检查 Schema,并在多家提供商之间路由。它回答“哪项能力最适合这个任务?”,横跨整个技术栈。

Key Differences Table关键差异表

ConceptLevelPurpose用途Key QuestionScope
Function CallingModel模型Structured execution format结构化执行格式How does the model call a function?模型如何调用函数?Single call
Tool CallingAgentAgentTool selection & executionWhich tool should the agent use?Agent 应使用哪个工具?Multi-tool
MCPProtocol协议Tool standardization工具标准化How are tools exposed?Ecosystem
QVeris RoutingQVeris 路由RoutingCapability selection across providers跨提供商选择能力Which capability is best?哪项能力最合适?Cross-tool intelligence跨工具智能
Function Calling vs Tool Calling vs MCPFunction Calling、Tool Calling 与 MCP 对比

Why All Layers Are Needed为什么需要所有层

AI agents fail when layers are collapsed into one. Each layer solves a distinct problem that the layer below cannot address:当层次被压缩为单一层时,AI Agent 会失败。每一层解决其下层无法解决的独特问题:

Function Calling Alone仅使用函数调用

Cannot choose between tools. The model can output get_price("AAPL") but cannot decide which of 10 price APIs to use, which has the right schema, or which is currently available.无法在工具之间进行选择。模型可以输出 get_price("AAPL"),但无法判断应使用 10 个价格 API 中的哪一个、哪个具有正确的 Schema,或哪个当前可用。

Tool Calling Alone仅使用工具调用

Without MCP, every tool has a custom integration format. Without a routing layer, tool selection is hardcoded and brittle — change one provider and the agent breaks.没有 MCP 时,每个工具都采用自定义集成格式;没有路由层时,工具选择被硬编码且非常脆弱,只要更换一家提供商,Agent 就可能失效。

MCP Alone仅使用 MCP

Standardizes connectivity but does not select tools, manage retries, handle fallback, or route by task intent. MCP answers "what tools exist?" — not "which tool should I use?"MCP 标准化连接方式,但不负责选择工具、管理重试、处理回退或按任务意图路由。它回答“有哪些工具?”,而不是“我应该使用哪个工具?”

No Routing Layer没有路由层

Without QVeris or equivalent routing, agents hardcode provider dependencies. When a provider changes its API, introduces rate limiting, or goes down, the agent has no recovery path.没有 QVeris 或同类路由层时,Agent 会硬编码对提供商的依赖。提供商更改 API、实施速率限制或宕机时,Agent 就没有恢复路径。

Execution Flow in Real AI Systems真实系统中的执行流程

agent_execution_flow.json — Terminal
// How the four layers work together in a real AI agent system { "user_request": "Get AAPL stock price with bid/ask spread", "execution_flow": [ {"step": "intent_understanding", "layer": "Tool Calling"}, {"step": "capability_discovery", "layer": "QVeris Routing"}, {"step": "tool_selection", "layer": "Tool Calling"}, {"step": "mcp_tool_access", "layer": "MCP Protocol"}, {"step": "function_call_execution", "layer": "Function Calling"}, {"step": "output_validation", "layer": "Tool Calling"}, {"step": "response_generation", "layer": "Agent"} ] }

MCP vs Tool Calling in PracticeMCP vs 工具调用实践

DimensionMCPTool CallingFunction Calling
Defines定义内容Tool exposure format工具暴露格式Tool execution logic工具执行逻辑Model output format
Answers回答的问题How are tools described?Which tool to use?How to invoke a function?
Operates at运行层级Protocol/ecosystem level协议/生态层Agent levelAgent 层Model level模型层
Standardized byAnthropic MCP specAnthropic MCP 规范Agent frameworkAgent 框架Model API (OpenAI, Anthropic, Google)模型 API(OpenAI、Anthropic、Google)
Handles selection?NoYesNo
Handles fallback?NoYes (with routing)No

Common Misconceptions常见误解

❌ Myth: MCP = tool routing
✔ Reality: MCP standardizes tool exposure. Tool routing (function calling + tool calling + QVeris) handles selection, execution, and fallback. Different layers.
❌ 误解:MCP = 工具路由
✔ 事实:MCP 标准化工具暴露;工具路由(函数调用 + 工具调用 + QVeris)负责选择、执行和回退。它们属于不同层级。
❌ Myth: Function calling = tool selection
✔ Reality: Function calling outputs which function to invoke with what parameters. It does not select between 10 different providers offering the same capability. That is tool calling and routing.
❌ 误解:函数调用 = 工具选择
✔ 事实:函数调用输出要调用的函数及其参数,但不会在提供同一能力的 10 家不同提供商之间进行选择;那属于工具调用和路由。
❌ Myth: Tool calling = protocol
✔ Reality: Tool calling is execution logic. MCP is a protocol specification. Execution and standardization are separate concerns.
❌ 误解:工具调用 = 协议
✔ 事实:工具调用是执行逻辑,MCP 是协议规范;执行与标准化是两类不同的问题。
❌ Myth: One layer can replace the others
✔ Reality: Production AI agents need all four layers. Collapsing layers creates fragile systems that work in demos but fail under real conditions.
❌ 误解:一个层级可以替代其他层级
✔ 事实:生产级 AI Agent 需要全部四层。压缩层级会产生只能在演示中运行、却在真实条件下失效的脆弱系统。

QVeris Capability Routing LayerQVeris 能力路由层

QVeris operates as a capability routing layer above MCP and tool calling systems. It does not replace function calling, tool calling, or MCP — it provides the routing intelligence that connects them into a production-grade agent architecture.QVeris 作为能力路由层运行在 MCP 和工具调用系统之上。它不替代函数调用、工具调用或 MCP — 它提供将它们连接成生产级 Agent 架构的路由智能。

🔍

Discover

Find relevant tools across MCP servers, external APIs, and capability catalogs — by task intent, not by hardcoded tool name.根据任务意图在 MCP 服务器、外部 API 和能力目录中查找相关工具,而不是依赖硬编码工具名称。

📐

Inspect

Validate schemas, check auth, review cost and latency, read provider notes — before calling. Catch mismatches early.调用前验证 Schema、检查认证、评估成本与延迟并阅读提供商说明,尽早发现不匹配。

Call & Route

Execute selected tool safely. On failure, route to ranked fallback. Never return "I couldn't complete the task" while fallbacks remain.安全执行选定工具;失败时路由到已排序的回退方案。只要仍有回退工具,就不应直接回复“无法完成任务”。

Validate & Report

Check output structure, timestamps, source metadata. Return structured result with full traceability across all four layers.检查输出结构、时间戳和来源元数据,并返回在四个层级中都具备完整可追踪性的结构化结果。

QVeris is a capability routing layer. It does not replace function calling, tool calling, or MCP. It provides the routing intelligence on top — helping agents discover, inspect, and route across tools and MCP systems. Read the docs → or view pricing →.QVeris 是能力路由层。它不替代函数调用、工具调用或 MCP。它在其上提供路由智能 — 帮助 Agent 发现、检查和跨工具及 MCP 系统路由。阅读文档 →查看定价 →

Production Architecture Pattern生产架构模式

production_architecture.json — Terminal
// Production AI agent — four-layer architecture pattern { "function_calling": "execution_format", "tool_calling": "agent_layer", "mcp": "protocol_layer", "qveris": "routing_layer", "workflow": [ "intent_understanding", "capability_discovery", "tool_selection", "execution", "validation" ] }

Getting Started Checklist快速上手指南

Understand function calling — model-level execution format理解函数调用 — 模型级执行格式
Understand tool calling — agent-level tool abstraction and execution理解工具调用 — Agent 级工具抽象和执行
Understand MCP — standardized tool protocol and exposure理解 MCP — 标准化工具协议和暴露
Separate execution logic from tool selection logic将执行逻辑与工具选择逻辑分离
Build a tool routing layer — don't hardcode single-provider dependencies构建工具路由层 — 不要硬编码单一提供商依赖
Add schema validation before every tool call在每次工具调用前添加 Schema 验证
Implement fallback strategies for every critical tool category为每个关键工具类别实现回退策略
Use QVeris capability routing for multi-provider agent systems使用 QVeris 能力路由构建多提供商 Agent 系统

Build Production AI Agent Systems with Clear Architecture用清晰的架构构建生产级 AI Agent 系统

QVeris provides the capability routing layer that connects function calling, tool calling, and MCP into a production-grade agent architecture. Discover and Inspect are free forever.QVeris 提供连接函数调用、工具调用和 MCP 的能力路由层,形成生产级 Agent 架构。Discover 和 Inspect 永久免费。

Build AI Agent Systems →构建 AI Agent 系统 →Explore QVeris Docs

FAQ常见问题

Does MCP replace function calling?MCP 替代函数调用吗?
No. MCP standardizes how tools are exposed to models and agents through a common protocol. Function calling is the model-level mechanism that outputs structured arguments to invoke a function. They operate at completely different layers — protocol vs execution format. MCP does not replace function calling; they serve different purposes.不。MCP 标准化了工具如何通过通用协议暴露给模型和 Agent。函数调用是模型级机制,输出结构化参数来调用函数。它们在不同的层次运行 — 协议 vs 执行格式。MCP 不替代函数调用;它们服务于不同的目的。
Is tool calling the same as MCP?
No. Tool calling is the agent-level abstraction that handles selecting, invoking, and coordinating tool execution — which tool to use, when to retry, where to fallback. MCP is a protocol that defines how tools are described and exposed. Tool calling = execution logic. MCP = standardization protocol. They work together but are not the same thing.不。工具调用是 Agent 级抽象,处理工具的选择、调用和协调执行 — 使用哪个工具、何时重试、在哪里回退。MCP 是定义如何描述和暴露工具的协议。工具调用 = 执行逻辑。MCP = 标准化协议。它们一起工作但不是同一件事。
What is the role of QVeris in the AI agent stack?
QVeris operates as a capability routing layer above MCP and tool calling systems. It helps agents discover relevant tools by task intent, inspect schemas before calling, and route across multiple providers — complementing function calling, tool calling, and MCP rather than replacing any of them.QVeris 作为能力路由层运行在 MCP 和工具调用系统之上。它帮助 Agent 按任务意图发现相关工具、在调用前检查 Schema、并跨多个提供商路由 — 补充函数调用、工具调用和 MCP 而不是替代它们中的任何一个。
Do I need all four layers in production?
Yes. Production AI agents need all four: function calling for structured model output, tool calling for agent-level execution logic and retry/fallback management, MCP for standardized tool connectivity across the ecosystem, and a routing layer like QVeris for intelligent tool selection and multi-provider fallback. Collapsing layers creates fragile demo-quality systems.是的。生产级 AI Agent 需要全部四层:函数调用用于结构化模型输出,工具调用用于 Agent 级执行逻辑和重试/回退管理,MCP 用于跨生态系统的标准化工具连接,以及像 QVeris 这样的路由层用于智能工具选择和多提供商回退。压缩层次会产生在演示中工作但在真实条件下失败的脆弱系统。