MCP 与函数调用
了解 MCP 与原始模型工具调用的区别。
MCP 与函数调用 是 CoddyKit 上的免费 MCP Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MCP Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MCP Academy 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
Two Ways to Give Models Tools
You already know models can call tools. So where does MCP fit? It is a standard way to ship those tools, not a replacement for the idea.
What Function Calling Is
With function calling, you define each tool inline in your own API request to the model, and your code runs whatever the model picks.
tools = [{
"name": "get_weather",
"input_schema": {"type": "object"}
}]Tools Live in Your App
In plain function calling, the tool list and the code that runs them both live inside your one app. Nothing is shared with anyone else.
MCP Moves Tools Out
MCP takes those tools and puts them behind a separate server. Any MCP-aware app can connect and use them without copying your code.
Reusable Across Apps
The big win is reuse: write a tool once as an MCP server, and Claude Desktop, an IDE, or your own agent can all share it.
Function Calling Is Per-Request
Function calling ships the tool schemas in every request. It is simple and direct, but each app must carry its own copy of every tool.
MCP Is Discoverable
An MCP client asks the server what it offers at connect time. Tools are discovered live, not hardcoded into each request.
tools = await session.list_tools()They Work Together
These are not rivals. Under the hood an MCP host often turns server tools into ordinary function-calling tools for the model to pick.
When Function Calling Wins
For a single app with a few private tools, plain function calling is lighter. No extra server, no transport, just your code.
When MCP Wins
Reach for MCP when the same capability must serve many clients, or when users plug your tools into apps you do not control.
The Mental Model
Think of function calling as a tool you carry in your pocket, and MCP as that tool published in a shop where anyone can pick it up.
Quick Check
Pick the clearest difference between MCP and plain function calling.
Recap
Function calling defines tools inline in one app; MCP publishes them as a reusable server. Same core idea, wider reach. Nice work! 🎉
常见问题解答
「MCP 与函数调用」课时是免费的吗?
是的 — 「MCP 与函数调用」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MCP Academy 课程的其余内容,请升级到 CoddyKit PRO。 MCP Academy 课程共包含 4 节课。
「MCP 与函数调用」这节课中我会学到什么?
了解 MCP 与原始模型工具调用的区别。 你通过在浏览器中直接运行的动手代码来练习 MCP Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 MCP Academy 需要有经验吗?
无需任何先前经验。CoddyKit 上的 MCP Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。
「MCP 与函数调用」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 MCP Academy 课中编写并运行代码吗?
能。每节 MCP Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。
此课程中的所有课时
- MCP 与函数调用
- 代理框架中的 MCP
- 使用 A2A 实现代理间通信
- MCP 下一步的发展方向