My MCP Tool Worked. I Still Couldn't Explain Why It Was Slow.
articleNovember 23, 2026By Ali Haghighi
A tool call succeeding is not the same as an AI workflow behaving well.
While building an operational AI prototype, I reached a familiar debugging problem: the response eventually arrived, but I couldn't immediately tell where the time had gone.
Was the model slow? Was the MCP call waiting? Was the downstream monitoring API taking too long? Or was the workflow spending time between those steps?
I didn't need another agent framework to answer that. I needed better timing boundaries.
One duration hides several problems
At first, looking only at the total request duration was tempting. It was also not very useful.
An AI-assisted investigation may involve model execution, tool selection, MCP transport, a downstream API, result processing, and another model turn. A single number combines all of them.
That matters because the fixes are different. A slow monitoring query needs a different response from a model spending too long generating tokens.
I started treating each boundary as something worth measuring separately.
A simplified timeline looks like this:
Investigation
-> model turn
-> MCP tool call
-> downstream API
-> result processing
-> model turn
-> responseThe goal isn't to instrument every line. It's to identify which part of the workflow owns the delay.
Measure the operation, not just the request
For tool execution, I want at least a tool name, elapsed time, outcome and correlation identifier. I don't need to log raw arguments or sensitive tool responses to get useful timing data.
A small .NET wrapper illustrates the idea:
var started = Stopwatch.GetTimestamp();
var outcome = "success";
try
{
return await tool.ExecuteAsync(request, cancellationToken);
}
catch (OperationCanceledException)
{
outcome = "cancelled";
throw;
}
catch
{
outcome = "error";
throw;
}
finally
{
var elapsed = Stopwatch.GetElapsedTime(started);
metrics.RecordToolDuration(tool.Name, outcome, elapsed);
}This is illustrative code, not a complete instrumentation layer. In a real service, the tool name must be a bounded metric label, and tracing should carry request-specific identifiers rather than putting them into high-cardinality metric dimensions.
The same principle applies to model calls. I want to distinguish total provider time from the time spent loading a local model, processing input and generating output when the provider exposes those measurements.
The second problem: a failed tool can look like a bad answer
Timing exposed another important design question: what should the workflow do when evidence is unavailable?
If a monitoring dependency times out, the model should not quietly turn missing data into a confident explanation.
I prefer a structured tool result that separates evidence from its availability:
status: unavailable
source: metrics
reason: timeout
observations: noneThe application can then present a limitation instead of pretending the missing metric supports a hypothesis.
That isn't just error handling. It is part of making AI-assisted operational work trustworthy.
What I took away
Two small changes made the design easier to reason about: measure each meaningful execution boundary, and represent unavailable evidence explicitly.
Neither change makes an AI system more autonomous. Both make it easier to debug, test and operate.
I'm exploring these ideas in a .NET-based prototype that connects AI workflows to operational tools through MCP. The interesting work has been less about making a model call a tool and more about understanding what happens before and after that call.
For now, that's the kind of engineering problem I want to keep writing about: one concrete failure mode, one design decision, and the trade-offs that remain.