Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Describe how a production MCP host should handle a tool call that runs past its latency budget in a user-facing response pipeline.
MCP defines no timeouts, so the host owns the budget: cancel the slow call, hand the model a graceful fallback, emit a trace span, and never block the user past the response deadline.
Imagine a chef taking orders. Each order goes to a different station, the grill, the bakery, the bar. The chef promises a plate in five minutes. If the grill is slow, the chef cannot just stand there waiting forever, or the whole table goes hungry. So the chef sets a timer per station. When the timer rings, the chef gives up on that one item, tells the kitchen 'grill is down, serve the rest', and writes a note about what was slow so tomorrow's timing is smarter. An MCP host is that chef. The protocol itself never sets a timer, so the host has to. It watches each tool call, cuts off the slow one, tells the model what happened so it can still answer the user, and logs the delay so the team can see where time keeps leaking.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: map where a multi-tool turn spends time, then the timeout failure path, per-tool deadlines from p95/p99, graceful fallback, parallel fan-out, caching, and trace spans.
| Where the time goes in a turn | Typical cost | How to reduce it |
|---|---|---|
| Transport (stdio vs HTTP) | Sub-ms local; one network round trip remote | Prefer local stdio; co-locate remote servers |
| Server execution | Varies per tool, the visible budget | Per-tool deadline from observed p95 |
| Model inference between calls | Hundreds of ms to seconds | Smaller routing model; fewer turns |
| Context re-prefill each turn | Grows every iteration, often dominant | Prompt caching; trim the transcript |
| Parallel vs sequential calls | Sum if run sequentially | Fan out independent calls concurrently |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming the MCP spec enforces timeouts. It does not. A host that waits forever on a slow server hangs the entire user response.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.