Model Context Protocol › Common failure modes
Language AI HandbookAll chapters 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]Expand
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]Expand

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!