MCP 工具調用成功,工作流程仍可能失敗
The MCP Tool Worked. The Workflow Still Failed.
MCP 工具成功返回,不代表 AI 智能體已正確完成任務;資料可能過時、操作對象可能有誤,或多步流程只完成一部分。文章提出以執行契約管理工作流程,明確設定前置條件、執行範圍、後置條件及失敗復原方式。高影響操作還應獨立核實最終狀態並保留可供審核的執行記錄。
There's something easy to overlook when building AI agents with MCP:
A successful tool call doesn't necessarily mean a successful task.
The server responded.
The tool returned a result.
No exception was raised.
Everything looks fine.
Except the agent may have changed the wrong record, acted on outdated information, or completed only half of what the user actually requested.
And that's where things get interesting.
A Successful Response Is Not Proof of a Correct Outcome
Imagine an AI agent is asked to upgrade a customer's subscription.
It calls an MCP tool:
{
"tool": "update_subscription",
"arguments": {
"customer_id": "cus_123",
"plan": "pro"
}
}
The server responds:
{
"success": true,
"status": "updated"
}
The agent reports:
"Subscription successfully upgraded."
But what if:
- The customer ID was resolved incorrectly?
- The subscription was already scheduled for cancellation?
- The update changed the plan but not the billing configuration?
- Another process modified the subscription between the initial read and the update?
- The response confirms that the request was accepted, not that the final state is correct? The tool did exactly what it was designed to do.
The workflow still may have failed.
MCP Solves an Important Problem, But Not This One
MCP gives AI applications a standardized way to discover and interact with tools and resources.
That's valuable.
It reduces the need for every integration to invent its own communication pattern.
But interoperability and operational correctness are different problems.
A standardized tool interface doesn't automatically guarantee:
- Correct interpretation of user intent.
- Valid assumptions about the current state.
- Safe execution when conditions change.
- Verification of the final result.
- Recovery when a multi-step workflow partially succeeds. In other words, MCP can help an agent communicate with a system. It doesn't automatically make the agent a reliable operator of that system. I Think We Need to Think in Terms of Execution Contracts Instead of treating a tool call as a single isolated action, I'd like to see more workflows designed around four explicit stages:
- Preconditions
What must be true before the action is allowed?
For example, the customer ID must be verified, the subscription must be active, and the requested plan must be available.
- Execution
What exactly is the tool expected to change?
The operation should have a clearly defined scope, rather than relying on assumptions hidden inside the agent's reasoning.
- Postconditions
What evidence proves that the intended state was actually reached?
Not just whether the API returned success, but whether a fresh read confirms the expected result.
- Recovery
What happens if the operation succeeds partially, times out, or produces an ambiguous result?
Should the agent retry, inspect the current state, request human approval, or stop?
This distinction becomes especially important when several MCP tools are chained together.
A workflow can have five individually successful calls and still produce an incorrect final outcome.
The Missing Layer Might Be Verification
Here's the architectural distinction I keep coming back to:
User Intent
|
v
AI Agent
|
v
MCP Tool Discovery
|
v
Precondition Check
|
v
Tool Execution
|
v
Independent State Verification
|
+---- Verified ----> Report Outcome
|
+---- Uncertain ---> Investigate / Escalate
|
+---- Failed ------> Recovery / Stop
The important part is that verification should not simply repeat the tool's success message.
It should inspect the resulting state independently whenever possible.
For high-impact operations, the agent should also preserve evidence of what it checked, what it changed, and why it considered the result successful.
That creates something much more useful than a conversation transcript: an execution trail that can actually be audited.
One Question Worth Discussing
As MCP adoption grows, I suspect we'll spend less time asking whether an agent can access a tool and more time asking whether we can trust what it does with that access.
A tool returning success: true is a technical response.
A task being completed correctly is an operational guarantee.
Those are not the same thing.
Where do you think responsibility for verification should live: inside each MCP server, in the agent orchestration layer, or in a separate execution and validation layer?
I'm particularly interested in how people are handling this in real multi-tool workflows.
來源:DEV Community · dev.to