Complete the JSON-RPC 2.0 request structure used by MCP
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
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.
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.
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.
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.