MCP function calling

MCP không thay function calling. Nó chuẩn hoá nơi tool sống.

MCP doesn't replace function calling. It standardizes where tools live.

Model vẫn gọi tool bằng function calling như trước. MCP lo phần còn lại: tìm tool ở đâu, gọi qua đâu, ai được phép.

The model still calls tools through function calling. MCP handles the rest: where tools are found, how they are reached, and who is allowed to use them.

Model quyết định gọi tool. Ứng dụng quyết định đính kèm resource. Người dùng quyết định chạy prompt.

The model decides to call a tool. The app decides to attach a resource. The user decides to run a prompt.

Một câu hỏi, hai lớp giao thứcOne question, two protocol layers

Phần nền xanh là function calling: host và model nói chuyện như mọi app có tool. Các mũi tên màu nâu vàng là MCP: host nói chuyện với server. Bước 0 chỉ chạy khi kết nối, không chạy ở mỗi câu hỏi. Nét đứt là thứ duy nhất quyết định lúc chạy: model chọn gọi tool.

The blue band is function calling: host and model talk like any tool-using app. The ochre arrows are MCP: the host talks to the server. Step 0 runs on connect, not on every question. The dashed line is the only runtime decision: the model chooses to call a tool.

  • Function calling (model ↔ host)Function calling (model ↔ host)
  • MCP (host ↔ server)MCP (host ↔ server)
  • Nét đứt: model quyết định lúc chạyDashed: decided by the model at runtime
Function calling and MCP in one requestSequence: host lists tools from the MCP server once; user asks; host sends prompt and tool schemas to the LLM; the LLM emits a tool call; host sends tools/call to the server; result flows back to the LLM, which answers.userhost+ MCP clientLLMMCPserver0tools/list · khi kết nối, có cachetools/list · on connect, cached1câu hỏiquestion2prompt + tool schemasprompt + tool schemas3tool_call · model tự quyếttool_call · model decides4tools/calltools/call5kết quảresult6kết quả tooltool result7câu trả lờianswer8câu trả lờianswer

Chọn cái nàoWhich one to use

Trước hết: có khi bạn không cần gì cảFirst: you may need none of this

Câu hỏi đầu tiên không phải "dùng function calling hay MCP", mà là "model có thật sự cần tự quyết định không". Trong rất nhiều trường hợp, câu trả lời là không.

The first question isn't "function calling or MCP". It's "does the model really need to decide anything". Very often the answer is no.

  • Dữ liệu cần dùng nhỏ và biết trước, như một bảng giá hay một tài liệu chính sách. Hãy đưa thẳng vào prompt.The data you need is small and known in advance, like a price list or a policy document. Put it straight into the prompt.
  • Luồng luôn cố định, ví dụ câu hỏi nào cũng cần tra thời tiết trước. Để code gọi API rồi đưa kết quả vào prompt; model không cần "chọn".The flow is always the same, for example every question needs the weather first. Let your code call the API and put the result in the prompt; the model doesn't need to "choose".
  • Bạn chỉ cần output có cấu trúc, như trích hoá đơn ra JSON. Dùng structured outputs, không cần vòng lặp tool.You only need structured output, like pulling an invoice into JSON. Use structured outputs, no tool loop.
  • Việc làm một lần, cho riêng bạn. Copy dữ liệu vào cuộc trò chuyện là đủ.A one-off task just for you. Pasting the data into the conversation is enough.

Nếu bước tiếp theo lúc nào cũng giống nhau, đừng để model chọn nó.If the next step is always the same, don't let the model choose it.

Phương án rẻ nhất: code gọi API, chèn kết quả vào prompt, gọi model một lần. Không vòng lặp tool, không giao thức, không server.

Cheapest option: your code calls the API, inserts the result into the prompt, and calls the model once. No tool loop, no protocol, no server.

Cây quyết địnhDecision tree

Model có cần TỰ quyết định lấy dữ liệu hay hành động giữa chừng không?
├─ Không ─▶ Code gọi API trước, đưa kết quả vào prompt. Xong.
└─ Có
   ├─ Tool chỉ dùng trong một app bạn sở hữu, khoảng dưới 10 tool?
   │   └─ Có ─▶ Function calling trực tiếp.
   └─ Cần dùng ở từ 2 host trở lên, hoặc người khác viết tool?
       └─ MCP server
           ├─ Một người, một máy, truy cập file/CLI ─▶ stdio
           └─ Nhiều người, dữ liệu riêng từng người ─▶ Streamable HTTP + OAuth
               └─ Doanh nghiệp có IdP (Okta, Entra) ─▶ thêm extension EMA

Bên trong server, ai quyết định thì dùng primitive đó:
   model quyết ─▶ tool    app đính kèm ─▶ resource    user bấm ─▶ prompt
Does the model need to DECIDE on its own to fetch data or act mid-conversation?
├─ No  ─▶ Your code calls the API first and puts the result in the prompt. Done.
└─ Yes
   ├─ Tools used only inside one app you own, roughly under 10 tools?
   │   └─ Yes ─▶ Direct function calling.
   └─ Needed in 2+ hosts, or tools written by someone else?
       └─ MCP server
           ├─ One person, one machine, file/CLI access ─▶ stdio
           └─ Many people, per-user data ─▶ Streamable HTTP + OAuth
               └─ Enterprise with an IdP (Okta, Entra) ─▶ add the EMA extension

Inside a server, whoever decides picks the primitive:
   model decides ─▶ tool    app attaches ─▶ resource    user clicks ─▶ prompt

Ảnh nói gì, thực tế ra saoWhat the images say, and what's accurate

Hai ảnh gốc đúng về đại thể. Đây là những chỗ cần sửa hoặc bổ sung, đối chiếu với changelog chính thức của spec 2026-07-28.

Both source images are broadly right. These are the points to correct or add, checked against the official 2026-07-28 changelog.

  1. Ảnh 1 đặt "Function Calling vs MCP" như hai lựa chọn loại trừ nhau.Image 1 frames "Function Calling vs MCP" as mutually exclusive choices.

    MCP chạy trên function calling. Ở bước 3–4 của chính sơ đồ MCP, model vẫn phát ra tool call qua function calling. MCP chỉ thay phần sau đó: host chuyển lời gọi tới một server chuẩn thay vì tới code tự viết.MCP runs on top of function calling. In steps 3–4 of the MCP diagram itself, the model still emits a tool call through function calling. MCP only replaces what happens next: the host routes the call to a standard server instead of hand-written code.

  2. Ảnh 1 vẽ list_tools ở mỗi câu hỏi (bước 2).Image 1 draws list_tools on every question (step 2).

    Tên đúng là tools/list, và host thường chỉ gọi khi kết nối hoặc khi cache hết hạn. Từ 2026-07-28, kết quả có ttlMs và cacheScope để cache, kèm thông báo listChanged khi danh sách đổi.The method is tools/list, and hosts usually call it on connect or when the cache expires. Since 2026-07-28 results carry ttlMs and cacheScope for caching, plus listChanged notifications when the list changes.

  3. Ảnh 1 đặt MCP server ở "Remote server".Image 1 places MCP servers on a "Remote server".

    Server có thể chạy từ xa qua Streamable HTTP hoặc chạy ngay trên máy qua stdio. Phần lớn server cho dev (filesystem, git) là local.A server can run remotely over Streamable HTTP or right on your machine over stdio. Most developer servers (filesystem, git) are local.

  4. Ảnh 2: "http+sse deprecated, 12-month offramp".Image 2: "http+sse deprecated, 12-month offramp".

    HTTP+SSE đã bị deprecated từ bản 2025-03-26. Bản 2026-07-28 chỉ xếp nó vào trạng thái Deprecated theo chính sách vòng đời mới, với cửa sổ tối thiểu 12 tháng trước khi gỡ. 12 tháng là mức sàn, không phải ngày cố định.HTTP+SSE has been deprecated since 2025-03-26. The 2026-07-28 revision just classifies it as Deprecated under the new lifecycle policy, which sets a minimum 12-month window before removal. Twelve months is a floor, not a fixed date.

  5. Ảnh 2: "no handshake since 2026-07-28".Image 2: "no handshake since 2026-07-28".

    Đúng với giao thức mới, nhưng chưa đủ: server bắt buộc phải có server/discover, và client mới vẫn quay về handshake initialize khi gặp server cũ. State không biến mất mà chuyển thành handle tường minh trong tham số tool.True for the new protocol, but incomplete: servers must implement server/discover, and new clients still fall back to the initialize handshake when they meet an older server. State doesn't disappear; it moves into explicit handles passed as tool arguments.

  6. Ảnh 2: "tokens bound to one issuer".Image 2: "tokens bound to one issuer".

    Chính xác hơn: credential của client (thứ có được khi đăng ký) gắn với authorization server đã cấp nó. Client phải lưu theo issuer và đăng ký lại nếu đổi AS. Access token thì gắn với đúng MCP server qua resource indicator.More precisely: client credentials (what you get from registration) are bound to the authorization server that issued them. Clients must key them by issuer and re-register if the AS changes. Access tokens are bound to a specific MCP server through resource indicators.

  7. Ảnh 2: "validate iss (RFC 9207)" và "dcr is deprecated, cimd replaces it".Image 2: "validate iss (RFC 9207)" and "dcr is deprecated, cimd replaces it".

    Authorization server nên gửi iss; client phải kiểm tra nếu có. DCR bị deprecated nhưng vẫn dùng được với AS chưa hỗ trợ Client ID Metadata Documents.Authorization servers should send iss; clients must validate it when present. DCR is deprecated but still allowed for authorization servers that don't support Client ID Metadata Documents yet.

  8. Ảnh 2 bỏ sót vài thay đổi quan trọng.Image 2 leaves out several important changes.

    Sampling, Roots và Logging đều bị deprecated. subscriptions/listen thay GET endpoint và resources/subscribe. Mọi result giờ có resultType. Stream SSE đứt thì mất request, không còn resume.Sampling, Roots and Logging are all deprecated. subscriptions/listen replaces the GET endpoint and resources/subscribe. Every result now carries resultType. A broken SSE stream loses the request; there is no resume anymore.

Tra cứu từng khái niệmConcept reference

F1

Function callingFunction calling

Lớp model ↔ ứng dụngModel ↔ app layer
appLLMtool_callyour code

Model trả về một lời gọi hàm dạng JSON; code của bạn chạy hàm đó rồi đưa kết quả lại cho model.

The model returns a function call as JSON; your code runs it and hands the result back to the model.

Dùng choUse for
Chatbot chăm sóc khách hàng tra trạng thái đơn hàng qua API nội bộ.A support chatbot that checks order status through an internal API.
ĐượcGain
Ít thành phần nhất: không process phụ, không giao thức, gỡ lỗi trong một codebase.Fewest moving parts: no extra process, no protocol, debugging stays in one codebase.
MấtLose
Không tái dùng được: muốn đưa cùng bộ tool vào Claude Desktop, Cursor hay IDE khác là phải tích hợp lại từ đầu.No reuse: bringing the same tools into Claude Desktop, Cursor or another IDE means integrating from scratch each time.

Đánh đổiTrade-off Chọn function calling trực tiếp là đổi khả năng tái dùng tool giữa các ứng dụng lấy sự đơn giản và độ trễ thấp trong một ứng dụng.Choosing direct function calling trades tool reuse across apps for simplicity and low latency inside one app.

Dấu hiệuTell-tale sign: Chỉ một app dùng các tool này, và chính bạn viết phần thực thi.Only one app uses these tools, and you write the execution code yourself.

A1

MCP (Model Context Protocol)MCP (Model Context Protocol)

Kiến trúc MCPMCP architecture
hostclientserverAPI

Giao thức mở chuẩn hoá cách ứng dụng AI tìm và gọi tool, đọc dữ liệu, dùng prompt từ server bên ngoài.

An open protocol that standardizes how AI apps discover and call tools, read data and use prompts from external servers.

Dùng choUse for
Đưa cùng một tích hợp (GitHub, Postgres, Slack) vào nhiều host khác nhau.Bringing one integration (GitHub, Postgres, Slack) into several hosts.
ĐượcGain
Viết một lần, dùng ở mọi host hỗ trợ MCP; hệ sinh thái server có sẵn rất lớn.Write once, use in every MCP host; a large ecosystem of ready-made servers.
MấtLose
Thêm một tầng: process hay service phải vận hành, đánh phiên bản, giám sát.One more layer: a process or service to run, version and monitor.

Đánh đổiTrade-off Chọn MCP là đổi thêm một tầng vận hành và một hop mạng lấy việc viết tool một lần, dùng ở mọi host.Choosing MCP trades an extra operational layer and a network hop for writing tools once and using them in every host.

Dấu hiệuTell-tale sign: Cùng một bộ tool phải chạy ở từ hai host trở lên, hoặc người viết tool không phải người viết app.The same tools must run in two or more hosts, or the person writing the tools isn't the person writing the app.

A2

HostHost

Kiến trúc MCPMCP architecture
UI + LLMclient 1client 2

Ứng dụng người dùng đang mở. Nó giữ model, giao diện và quyền quyết định cái gì được chạy.

The app the user has open. It holds the model, the UI and the final say on what gets run.

Dùng choUse for
Dùng Claude Code hay Claude Desktop với server filesystem, git.Using Claude Code or Claude Desktop with filesystem and git servers.
ĐượcGain
Một chỗ duy nhất để đặt chính sách bảo mật và bước xác nhận.One place to put security policy and confirmation steps.
MấtLose
Tự làm host là tự gánh phần khó nhất: phân quyền, UI xác nhận, ghép tool vào prompt.Building a host means owning the hardest part: permissions, confirmation UI, merging tools into the prompt.

Đánh đổiTrade-off Tự làm host là đổi công xây phần phân quyền và trải nghiệm lấy toàn quyền kiểm soát chính sách và UX.Building your own host trades the work of permissions and UX for full control over policy and experience.

Dấu hiệuTell-tale sign: Hỏi "ai hiện hộp xác nhận cho người dùng" thì câu trả lời là host.Ask "who shows the user a confirmation dialog" and the answer is the host.

A3

ClientClient

Kiến trúc MCPMCP architecture
client 1github

Thành phần bên trong host giữ đúng một kết nối tới đúng một server.

The component inside the host that holds exactly one connection to exactly one server.

Dùng choUse for
SDK chính thức dùng khi bạn tự làm host.The official SDK you use when building your own host.
ĐượcGain
Cô lập lỗi: một server treo không kéo sập các kết nối khác.Fault isolation: one hung server doesn't take down the other connections.
MấtLose
Nhiều server là nhiều process (stdio) hoặc nhiều kết nối phải quản lý.Many servers means many processes (stdio) or many connections to manage.

Đánh đổiTrade-off Mô hình một client cho mỗi server đổi chi phí quản lý nhiều kết nối lấy sự cô lập lỗi và bảo mật giữa các server.One client per server trades the cost of managing many connections for fault and security isolation between servers.

Dấu hiệuTell-tale sign: Mỗi lần thêm một server là thêm một client.Every server you add is one more client.

A4

ServerServer

Kiến trúc MCPMCP architecture
your APIservertools · resources · prompts

Lớp vỏ mỏng bọc quanh API bạn đã có, phơi ra ba thứ: tools, resources, prompts.

A thin skin over the API you already have, exposing three things: tools, resources, prompts.

Dùng choUse for
Bọc API nội bộ (CRM, ticket) để mọi trợ lý AI trong công ty dùng được.Wrapping an internal API (CRM, tickets) so every AI assistant in the company can use it.
ĐượcGain
Với SDK, một tool đơn giản chỉ tốn vài chục dòng.With an SDK, a simple tool takes a few dozen lines.
MấtLose
Bọc nguyên si mọi endpoint REST thành tool là lỗi rất hay gặp: quá nhiều tool, quá vụn, model chọn sai.Wrapping every REST endpoint one-to-one is a common mistake: too many tools, too granular, wrong picks.

Đánh đổiTrade-off Viết server mỏng là đổi một chút công thiết kế lại giao diện cho model lấy việc tái dùng ở mọi host mà không đụng vào logic gốc.A thin server trades a little redesign work for the model's sake for reuse in every host without touching core logic.

Dấu hiệuTell-tale sign: Bạn đã có một API và muốn AI dùng nó mà không phải tích hợp lại trong từng app.You already have an API and want AI to use it without re-integrating it in every app.

P1

ToolsTools

Primitive: ai quyết địnhPrimitives: who decides
modelsearch(q)

Hành động mà model tự quyết định gọi.

Actions the model decides on its own to call.

Dùng choUse for
search_issues, create_pr, run_query.search_issues, create_pr, run_query.
ĐượcGain
Linh hoạt nhất: model tự kết hợp nhiều tool để giải bài toán.Most flexible: the model combines tools on its own to solve a problem.
MấtLose
Model có thể gọi nhầm tool, sai tham số, hoặc gọi khi không cần.The model can call the wrong tool, pass bad arguments, or call when it shouldn't.

Đánh đổiTrade-off Biến một việc thành tool là đổi tính dự đoán được lấy quyền tự quyết của model.Making something a tool trades predictability for the model's autonomy.

Dấu hiệuTell-tale sign: Model phải tự quyết định có làm việc này hay không, ngay giữa cuộc hội thoại.The model has to decide by itself, mid-conversation, whether to do this.

P2

ResourcesResources

Primitive: ai quyết địnhPrimitives: who decides
appspec.mdcontext

Dữ liệu mà ứng dụng chủ động đính kèm vào context. Là ngữ cảnh, không phải hành động.

Data the app chooses to attach to the context. Context, not an action.

Dùng choUse for
Đính kèm schema database trước khi nhờ viết SQL.Attaching a database schema before asking for SQL.
ĐượcGain
Không tốn lượt gọi tool; dữ liệu có sẵn từ đầu.No tool round-trip; the data is there from the start.
MấtLose
Nhiều host hỗ trợ resources kém hơn tools, hoặc chỉ cho người dùng chọn tay.Many hosts support resources worse than tools, or only through manual picking.

Đánh đổiTrade-off Chọn resource thay vì tool là đổi khả năng model tự đi lấy dữ liệu lấy sự chủ động và chi phí dự đoán được của ứng dụng.Choosing a resource over a tool trades the model's ability to fetch data itself for the app's control and predictable cost.

Dấu hiệuTell-tale sign: Dữ liệu cần có sẵn trước khi model bắt đầu suy nghĩ, và việc lấy nó không gây tác dụng phụ.The data must be there before the model starts thinking, and fetching it has no side effects.

P3

PromptsPrompts

Primitive: ai quyết địnhPrimitives: who decides
user/reviewmessages

Mẫu prompt do server cung cấp; người dùng chủ động chọn để chạy.

Prompt templates shipped by the server; the user chooses to run them.

Dùng choUse for
/review để review pull request theo checklist của team./review to review a pull request against the team's checklist.
ĐượcGain
Đóng gói kinh nghiệm thành một nút bấm; người mới cũng làm đúng quy trình.Packs experience into one button; newcomers follow the right process.
MấtLose
Mức hỗ trợ không đồng đều giữa các host.Uneven support across hosts.

Đánh đổiTrade-off Chọn prompt là đổi tính tự động lấy quyền kiểm soát rõ ràng của người dùng.Choosing a prompt trades automation for explicit user control.

Dấu hiệuTell-tale sign: Đây là việc người dùng muốn bấm một nút để chạy, theo cách làm cả team đã thống nhất.It's something the user wants to trigger with one click, the way the whole team agreed to do it.

W1

JSON-RPC và _metaJSON-RPC and _meta

Trên đường truyềnOn the wire
request + _metaresult

Định dạng thông điệp của MCP; từ 2026-07-28, mỗi request tự mang đủ ngữ cảnh của nó.

MCP's message format; since 2026-07-28 every request carries its own context.

Dùng choUse for
Đọc log để tìm lý do một tool call thất bại.Reading logs to find why a tool call failed.
ĐượcGain
Đơn giản, đọc được bằng mắt, có thư viện ở mọi ngôn ngữ.Simple, human-readable, with libraries in every language.
MấtLose
JSON dài dòng hơn định dạng nhị phân.JSON is more verbose than binary formats.

Đánh đổiTrade-off Để mỗi request tự mang ngữ cảnh là đổi vài trăm byte lặp lại lấy việc không phải nhớ gì giữa các request.Making every request carry its own context trades a few hundred repeated bytes for remembering nothing between requests.

Dấu hiệuTell-tale sign: Bạn đang nhìn JSON thô trên đường truyền và cần hiểu nó.You are looking at raw JSON on the wire and need to understand it.

W2

TransportsTransports

Trên đường truyềnOn the wire
stdio: localHTTP POST: remote

Hai đường truyền: stdio cho process chạy local, Streamable HTTP cho server từ xa.

Two transports: stdio for local processes, Streamable HTTP for remote servers.

Dùng choUse for
stdio: filesystem, git, script cá nhân trên máy dev.stdio: filesystem, git, personal scripts on a dev machine.
ĐượcGain
stdio không cần mạng, không cần auth, khởi động trong vài trăm ms.stdio needs no network and no auth, and starts in a few hundred ms.
MấtLose
stdio chạy với toàn bộ quyền của người dùng, mỗi máy một bản, khó cập nhật đồng loạt.stdio runs with the user's full permissions, one copy per machine, hard to update everywhere.

Đánh đổiTrade-off Chọn stdio là đổi khả năng dùng chung và quản lý tập trung lấy sự đơn giản không cần mạng hay auth.Choosing stdio trades sharing and central management for simplicity with no network or auth.

Dấu hiệuTell-tale sign: Một người, trên một máy, dùng server đó thì stdio là đủ.One person on one machine using the server means stdio is enough.

W3

StatelessStateless

Trên đường truyềnOn the wire
clientload balancerany instance

Không handshake, không session: request nào tới instance nào cũng được.

No handshake, no session: any request can land on any instance.

Dùng choUse for
Chạy nhiều instance server sau load balancer round-robin.Many server instances behind a round-robin load balancer.
ĐượcGain
Scale ngang không cần sticky routing hay kho session dùng chung.Horizontal scaling without sticky routing or a shared session store.
MấtLose
State không biến mất mà chuyển thành handle trong tham số tool; bạn phải tự thiết kế, đặt hạn và bảo vệ chúng.State doesn't vanish; it moves into handles in tool arguments that you must design, expire and protect.

Đánh đổiTrade-off Chọn giao thức stateless là đổi việc tự quản lý state tường minh lấy khả năng mở rộng như một HTTP service bình thường.Choosing a stateless protocol trades managing explicit state yourself for scaling like an ordinary HTTP service.

Dấu hiệuTell-tale sign: Bạn đang tính dùng sticky session hay Redis để giữ session MCP: giờ không cần nữa.You're planning sticky sessions or Redis to hold MCP sessions: you no longer need them.

T1

MRTR (Multi Round-Trip Requests)MRTR (Multi Round-Trip Requests)

Tương tác & niềm tinInteraction & trust
callinput_requiredretry + answerscomplete

Tool cần hỏi thêm thì trả "input_required"; client hỏi người dùng rồi gọi lại.

A tool that needs more input returns "input_required"; the client asks the user and calls again.

Dùng choUse for
Xác nhận trước thao tác phá huỷ: xoá repo, chuyển tiền.Confirming a destructive action: deleting a repo, moving money.
ĐượcGain
Chạy được với server stateless, không phải giữ kết nối mở.Works with stateless servers; no open connection to hold.
MấtLose
Thêm một vòng request là thêm độ trễ.An extra round trip adds latency.

Đánh đổiTrade-off MRTR đổi thêm một vòng request lấy việc server không phải giữ kết nối hay trạng thái chờ.MRTR trades one more round trip for a server that holds no connection or pending state.

Dấu hiệuTell-tale sign: Tool không thể làm xong nếu không hỏi người dùng thêm một điều.The tool can't finish without asking the user one more thing.

T2

AuthAuth

Tương tác & niềm tinInteraction & trust
clientauth servertokenmcp server

OAuth 2.1 cho server từ xa; credential gắn với đúng một authorization server.

OAuth 2.1 for remote servers; client credentials bound to exactly one authorization server.

Dùng choUse for
Remote server truy cập dữ liệu riêng của người dùng như email, repo.A remote server that reaches a user's private data, like email or repos.
ĐượcGain
Dựa trên chuẩn OAuth đã được kiểm chứng, thư viện có sẵn.Built on proven OAuth standards with existing libraries.
MấtLose
Phần phức tạp nhất của cả spec; sai một bước là thành lỗ hổng.The most complex part of the spec; one wrong step becomes a vulnerability.

Đánh đổiTrade-off Làm đúng OAuth là đổi độ phức tạp tích hợp lấy việc không phải tự phát minh lại cơ chế bảo mật.Doing OAuth properly trades integration complexity for not reinventing security yourself.

Dấu hiệuTell-tale sign: Server chạy từ xa và trả dữ liệu khác nhau tuỳ người gọi.The server runs remotely and returns different data depending on who calls.

T3

ExtensionsExtensions

Tương tác & niềm tinInteraction & trust
core (small)tasksMCP AppsEMA

Lõi được giữ nhỏ có chủ đích; Tasks, MCP Apps và EMA nằm ngoài lõi dưới dạng extension.

The core stays small on purpose; Tasks, MCP Apps and EMA live outside it as extensions.

Dùng choUse for
Tasks: build, export dữ liệu, việc chạy vài phút.Tasks: builds, data exports, jobs that take minutes.
ĐượcGain
Lõi ổn định, ít thay đổi phá vỡ tương thích (breaking change).A stable core with few breaking changes.
MấtLose
Hỗ trợ phân mảnh; phải kiểm tra từng host.Fragmented support; check every host.

Đánh đổiTrade-off Đẩy tính năng ra ngoài lõi là đổi sự đồng đều giữa các host lấy một lõi nhỏ và ổn định.Pushing features out of the core trades consistency across hosts for a small, stable core.

Dấu hiệuTell-tale sign: Bạn cần thứ lõi không có, và cả hai phía đều cập nhật được.You need something the core lacks, and both sides can be updated.

Bảng đánh đổiTrade-off tables

Ba cách nối tool vào model
TrụcFunction calling trực tiếpMCP qua stdioMCP qua Streamable HTTP
Chi phí dựng ban đầuThấpTrung bìnhCao: triển khai, TLS, OAuth
Tái dùng giữa các hostKhôngCó, nhưng cài trên từng máyCó, chỉ cần cắm URL
Độ trễ thêm mỗi lần gọiGần 0 (in-process)Vài ms (IPC)Một hop mạng, chục tới trăm ms
Vận hànhNằm trong appCập nhật từng máyNhư một HTTP service
Bề mặt bảo mậtCode của bạnToàn bộ quyền của user trên máyMạng công khai + OAuth
Ai viết mô tả toolBạnTác giả serverTác giả server
Three ways to wire tools to a model
AxisDirect function callingMCP over stdioMCP over Streamable HTTP
Initial setup costLowMediumHigh: deploy, TLS, OAuth
Reuse across hostsNoYes, but installed per machineYes, just plug in a URL
Added latency per callNear zero (in-process)A few ms (IPC)One network hop, tens to hundreds of ms
OperationsLives inside the appUpdate every machineLike any HTTP service
Security surfaceYour codeThe user's full permissions on the machinePublic network + OAuth
Who writes tool descriptionsYouServer authorServer author
Ba primitive của server
TrụcToolsResourcesPrompts
Ai quyết địnhModelỨng dụng hoặc người dùngNgười dùng
Vào context khi nàoSau khi model gọiTrước khi model suy nghĩKhi người dùng chọn
Tác dụng phụCó thể cóKhông (chỉ đọc)Không (chỉ sinh message)
Mức hỗ trợ ở hostGần như mọi hostKhông đồng đềuKhông đồng đều
The three server primitives
AxisToolsResourcesPrompts
Who decidesThe modelThe app or the userThe user
Enters context whenAfter the model calls itBefore the model starts thinkingWhen the user picks it
Side effectsPossibleNone (read-only)None (just messages)
Host supportAlmost every hostUnevenUneven

Host, client, JSON-RPC, stateless, MRTR, auth và extensions không có mặt trong bảng vì chúng không phải lựa chọn thay thế nhau. Bạn không chọn giữa host và client; bạn dùng cả hai.

Host, client, JSON-RPC, stateless, MRTR, auth and extensions are left out because they are not alternatives to each other. You don't choose between a host and a client; you use both.

Anti-patterns

Sai lầmVì sao saiSửa thế nào
Bọc mọi endpoint REST thành một toolVài chục tool chồng chéo, model chọn sai, tốn token ở mọi lượtGộp theo tác vụ, giữ khoảng 5–15 tool mỗi server
Dựng MCP cho một app, vài tool, không ai khác dùngThêm một tầng vận hành mà không có lợi ích tái dùngFunction calling trực tiếp; chuyển sang MCP khi có host thứ hai
Để model "quyết định" một bước lúc nào cũng giống nhauThêm vòng gọi, thêm cơ hội sai, thêm độ trễCode gọi trước, đưa kết quả vào prompt
Gọi tools/list ở mỗi câu hỏiChậm và lãng phíCache theo ttlMs, lắng nghe listChanged
Giữ session bằng sticky routing hoặc Mcp-Session-Id cho server mớiSpec 2026-07-28 đã bỏ sessionDùng handle tường minh trong tham số tool
Ghi log ra stdout ở server stdioPhá luồng JSON-RPC, host báo lỗi khó hiểuGhi ra stderr
Cắm server cộng đồng mà không đọcTool poisoning, lộ dữ liệu, chạy lệnh ngoài ý muốnĐọc mô tả và mã nguồn, chạy với quyền tối thiểu
Chuyển tiếp token của người dùng xuống API phía sauConfused deputy, vượt quyền, mất auditXin token riêng cho API phía sau
Tool phá huỷ không có bước xác nhậnPrompt injection có thể kích hoạt nóGắn destructiveHint và xác nhận qua MRTR
Dùng DCR, HTTP+SSE, Sampling cho triển khai mớiĐều đã deprecatedCIMD, Streamable HTTP, gọi thẳng API của model
MistakeWhy it's wrongFix
Wrapping every REST endpoint as a toolDozens of overlapping tools, wrong picks, tokens burned every turnGroup by task; keep about 5–15 tools per server
Building MCP for one app with a few tools nobody else usesAn extra operational layer with no reuse benefitDirect function calling; move to MCP when a second host appears
Letting the model "decide" a step that's always the sameMore round trips, more chances to fail, more latencyCall it in code first and put the result in the prompt
Calling tools/list on every questionSlow and wastefulCache per ttlMs, listen for listChanged
Holding sessions with sticky routing or Mcp-Session-Id in new serversThe 2026-07-28 spec removed sessionsUse explicit handles in tool arguments
Logging to stdout in a stdio serverBreaks the JSON-RPC stream; the host shows cryptic errorsLog to stderr
Plugging in community servers without reading themTool poisoning, data leaks, unintended commandsRead descriptions and source; run with least privilege
Forwarding the user's token to downstream APIsConfused deputy, privilege escalation, lost audit trailObtain a separate token for the downstream API
Destructive tools with no confirmation stepPrompt injection can trigger themSet destructiveHint and confirm through MRTR
Using DCR, HTTP+SSE or Sampling in new deploymentsAll deprecatedCIMD, Streamable HTTP, call the model API directly

Ba câu cần nhớThree things to remember

  1. MCP không thay function calling. Model vẫn gọi tool như cũ; MCP chuẩn hoá nơi tool sống và đường đi tới đó.MCP doesn't replace function calling. The model calls tools as before; MCP standardizes where tools live and how to reach them.
  2. Ai quyết định thì chọn primitive đó: model quyết là tool, ứng dụng đính kèm là resource, người dùng bấm là prompt.Whoever decides picks the primitive: the model decides, it's a tool; the app attaches, it's a resource; the user clicks, it's a prompt.
  3. Từ 2026-07-28, mỗi request tự đứng một mình. State không biến mất; nó nằm trong handle tường minh, không trong session.Since 2026-07-28 every request stands alone. State doesn't vanish; it lives in explicit handles, not in a session.