Complete the JSON-RPC 2.0 request structure used by MCP
Every MCP request is a JSON-RPC 2.0 envelope: jsonrpc set to "2.0", a method name, params for arguments, and an id for correlation that notifications omit.
Think of mailing a letter that needs a reply. You write it on standard letterhead so the recipient knows the format, that is the jsonrpc "2.0" field. You say what you want done, that is the method. You enclose the details, that is params. And you stamp a tracking number so the reply can be matched back to your letter, that is the id. If you do not need a reply, like dropping off a notice, you skip the tracking number entirely. The recipient mails back a matching letter carrying either a result or an error, stamped with the same tracking number so you know which request it answers. MCP just sends these letters between the host app and the tool server.
Detailed answer & concept explanation~7 min readEverything 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. 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.
3 min: name the four request fields, contrast request vs response vs notification, explain id correlation, and cover the result or error rule.
// request (expects a response)
{ "jsonrpc": "2.0", "id": 7, "method": "tools/call",
"params": { "name": "search", "arguments": { "q": "mcp" } } }
// success response
{ "jsonrpc": "2.0", "id": 7, "result": { "content": [] } }
// error response
{ "jsonrpc": "2.0", "id": 7, "error": { "code": -32602, "message": "Invalid params" } }
// notification (no id, no response)
{ "jsonrpc": "2.0", "method": "notifications/progress",
"params": { "progressToken": 7, "progress": 0.5 } }| Field | Request | Response | Notification |
|---|---|---|---|
| jsonrpc | "2.0" (required) | "2.0" (required) | "2.0" (required) |
| method | Required, names op | Absent | Required, names event |
| params | Arguments object | Absent | Event payload |
| id | Required, correlates | Echoes request id | Omitted (the signal) |
| result / error | Absent | Exactly one present | Absent |
Real products, models, and research that use this idea.
- Claude Code and Claude Desktop exchange these exact JSON-RPC envelopes with every registered MCP server over stdio at session start.
- The mcp-inspector debugging tool prints raw request and response objects so you can see the jsonrpc, method, params, and id fields on the wire.
- Cursor and Zed both speak the same JSON-RPC 2.0 framing, which is why one MCP server runs unchanged across all three hosts.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does a client correlate responses when several requests are in flight at once?
QWhy does JSON-RPC make result and error mutually exclusive instead of allowing both?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Forgetting that omitting id turns a request into a notification, or putting arguments at the top level instead of nesting them under params.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.