Model Context Protocol › Common failure modes

Michael BrenndoerferDecember 1, 20263 min read
Language AI HandbookAll chapters
Part 49 of 67Long-Horizon Agents and Interoperability
Chapter 377Model Context Protocol › Common failure modes
Reading section 11 of 14 · Common failure modes · 3 minSection 11 of 14 · 3 min

Section 11 of 14 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Once the request arrives, inspect the response layer before deciding how to recover. An HTTP transport check, a JSON-RPC error and a failed tool lookup can leave similar-looking messages in a chat interface. They give different directions to the person diagnosing the bug. For HTTP, verify the request framing and mirrored headers first when the transport rejects the request. For a structured JSON-RPC error, read its code and safe diagnostic fields. For a tool outcome, use that tool's application semantics. A missing catalog title can be a valid outcome that the reader can correct by checking the entry ID.

The notebook records one outcome per chosen probe. Two use the JSON-RPC error path, one reaches the tool and fails to find a record, and one returns a record. This table concerns requests that reached the toy dispatcher; the separate host diagram includes proposals stopped before dispatch. It gives a small regression set you can keep next to your adapter tests.

PythonIn [21]
CollapseExpand
probe_replies = {
    "Unsupported revision": bad_version,
    "Malformed arguments": invalid,
    "Unknown record": missing["reply"],
    "Known record": approved["reply"],
}
reply_channels = ("Protocol error", "Tool error", "Success")
observed_channels = {}
for label, reply in probe_replies.items():
    if "error" in reply:
        channel = "Protocol error"
    elif reply["result"].get("isError", False):
        channel = "Tool error"
    else:
        channel = "Success"
    observed_channels[label] = channel
assert list(observed_channels.values()) == [
    "Protocol error",
    "Protocol error",
    "Tool error",
    "Success",
]
VisualizationOut [22]
CollapseExpand
Four rows show unsupported revision and malformed arguments landing in Protocol error, unknown record landing in Tool error, and known record landing in Success.
The four actual dispatcher replies exercise separate error and success channels. Handle the response envelope before interpreting the tool result.

Make the positive case prove more than successful deserialization. In a connection test, inspect whether the discovered operation schema matches the handler that executed, and verify that the actual output maps to the expected user result. Pair it with a denied-caller case, a declined-approval case, an unsupported-revision case and a missing-record case. Durable tests assert the reason or response shape, so one generic failure cannot make every test appear to pass.

For diagnosis in a shared app, record the selected server, protocol revision, method, decision stage and outcome with the information needed to correlate the request. Agree on a format with the service owner, particularly if two servers use the same method names. Keep credentials and unrelated catalog content out of diagnostics. A useful incident record can explain which check failed without disclosing the record that the permission check was meant to protect.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy