An MCP Tool Call Can Resolve and Still Fail
Post · https://dev.to/gde/an-mcp-tool-call-can-resolve-and-still-fail-52kc
An await finishes. The application returns a result. The trace contains a completed tool span. The...
First seen by Oriel on .
AI summary
This article demonstrates that JavaScript promise completion, MCP protocol responses, and actual side effects are distinct success signals requiring separate assertions and recovery policies.
- MCP tool results can resolve normally while carrying isError: true, so completion-only tests may incorrectly pass.
- A synthetic agent-inspect@6.31.35 fixture shows wrapMcpClient preserves the original response and records a failed outcome observation.
- A TraceContract requiring completion passes, while one configured with observations: { failOn: ["failed"] } fails.
- isError does not classify retryability; applications should use bounded policies, distinguish reads from writes, and preserve uncertainty.
- Integration tests should cover normal results, thrown errors, isError, cancellation, method receivers, lifecycle methods, and independently counted server calls.
#mcp #agent testing #observability #error handling
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Reactions
Total public reactions reported by the source; distinct from points and likes.
- DEV Community: 31, latest observation ; +8 over observed period since
Comments
Comment count reported by the source.
- DEV Community: 56, latest observation ; +39 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| DEV Community | 5031591 | https://dev.to/gde/an-mcp-tool-call-can-resolve-and-still-fail-52kc Read discussion |