Where’s my order #1042?
It’s a simple question for a store chatbot. The order number is right there, and a short answer will do. But the one piece of information the customer actually wants is missing from the message: the current shipping status.
The store already has that information. What the chat application needs is a way to find the right operation, pass it order 1042, and use the result in its reply. That’s where the Model Context Protocol (MCP) comes in.
Let’s follow one order lookup from the chat window to the backend and back. Then we’ll look at how MCP fits alongside a REST API and what happens when the customer asks a follow-up.
The parts of an MCP integration
Four pieces take part in the order lookup. The model and the MCP client have different jobs, even though the AI host coordinates both.
| Component | What it does |
|---|---|
| AI host | Runs the chat experience, manages conversation context, and decides which tools the model can use. It applies app policy and asks the user for approval when required. |
| MCP client | Lives inside the host and exchanges MCP messages with one server. It requests tool definitions, sends calls, and receives replies. |
| MCP server | Exposes tools such as get_order_status. It validates inputs, enforces access controls, calls the downstream service, and packages the result. |
| Orders backend | Owns order data and the rules for accessing it. In this example, it exposes an HTTP endpoint for checking an order’s status. |
Lets follow order #1042 through the system
1.The client discovers which tools are available
The host needs tool definitions before the model can choose a tool. It can get them ahead of the user’s question or reuse a cached list. When discovery is needed, the MCP client sends tools/list. The client sends a credential with the request. The server validates it and can limit the returned tools to those available to that caller. The list comes back to the client, and the host makes the relevant definitions available to the model.
The list response already contains the description and input schema.
{
"name": "get_order_status",
"description": "Get the current shipping status of an order by ID.",
"inputSchema": {
"type": "object",
"properties": {
"order_id": { "type": "integer" }
},
"required": ["order_id"]
}
}
2.The model proposes a call and the host checks it
From “Where’s my order #1042?”, the model proposes get_order_status with order_id: 1042. The host checks whether the call is allowed and prompts for approval if its policy requires it. Once allowed, the MCP client sends tools/call. Here’s an illustrative request with required _meta fields omitted for readability.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_order_status",
"arguments": { "order_id": 1042 }
}
}
The JSON-RPC id pairs the reply with this request. The order_id tells the store which record to look up.
3.The MCP server checks access and calls the backend
The server validates the incoming credential and checks whether the caller has permission to invoke the tool. It also validates the arguments against the tool’s input schema. The host decides whether to send the call. The server decides whether to accept it.
The handler calls GET /orders/1042/status using a credential intended for the orders API. The backend checks that the authenticated customer is allowed to read order 1042 before returning its status.
4.The server formats the result and the host gives it to the model
The tool handler reads the backend response, maps it to the fields the tool exposes, and can leave internal fields out. The MCP server sends a JSON-RPC reply to the MCP client, using the same request ID. Here’s the data in the reply’s structuredContent field.
{
"order_id": 1042,
"status": "shipped"
}
The client hands the result to the host. The host supplies it to the model, which can now reply:
_Order #1042 has shipped.
_
Why not give the model the REST APIs directly?
You can integrate a REST endpoint directly. Define a tool in your model provider’s format, map its arguments to the HTTP request, and have your application execute it with the right credentials. This works well when an app calls a small set of known endpoints. OpenAPI can describe those endpoints, and your host can use that description to build tool definitions.
As you add hosts or model providers, the work is in each integration. Someone has to make operations discoverable, map arguments and results, and handle errors. With MCP, compatible hosts can use the same server-side tool definition and call contract. Each host still translates that definition into whatever its model expects. The store’s REST endpoint and the code that maps get_order_status to it can be shared across those hosts.
What if the customer asks, “Has it arrived yet?
The host can give the model the earlier conversation. That lets the model resolve it to order 1042 and propose another lookup with the same ID. The client sends a fresh request, and the backend returns whatever status it currently has.
If the backend times out, the MCP server can return a tool error with isError: true. The client can pass that result through the host to the model, which can say it couldn’t check the latest status. The earlier “shipped” response is still part of the conversation, but it came from an earlier lookup. MCP tools specification
The conversation has state because the host retains context. The orders service has state because it stores the order.

Top comments (0)