LearnThatStack Ace your next interview
Model Context Protocol (MCP) · question
Question 7 of 56

What is the wire format of MCP messages? Describe the JSON-RPC 2.0 basics the protocol relies on.

beginner
← All Model Context Protocol (MCP) questions
Re-explain

MCP messages are JSON-RPC 2.0 messages, UTF-8 JSON objects that carry "jsonrpc": "2.0". The transport only decides how they are framed and delivered.

There are three shapes. A request has an id, a method, and optional params, and expects exactly one reply. A response repeats that id with either result or error, never both. A notification has a method but no id, so nothing is sent back.

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_weather","arguments":{"city":"Oslo"}}}
{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"12C, clear"}]}}

An id is a string or an integer, never null, and a sender never reuses one still awaiting its reply. An error holds an integer code, a message, and optional data. Batching was allowed early on, then removed in the 2025-06-18 revision.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for Model Context Protocol (MCP) One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

What you can say

  1. MCP messages are JSON-RPC 2.0, so each one is a UTF-8 JSON object with a jsonrpc field set to 2.0, and the transport only decides how it gets framed and delivered.
  2. There are three shapes. A request has an id, a method and optional params, and it expects exactly one reply.
  3. A response repeats that id with either a result or an error, never both, and an error carries an integer code, a message and optional data.
  4. A notification has a method but no id, so nothing comes back, which fits one-way messages like a progress update.
  5. Ids are strings or integers, never null, and a sender never reuses one that is still waiting on its reply.
  6. I'd point out that batching was allowed early on but removed in the 2025-06-18 revision, so don't design around sending arrays of messages.

Weak answers to avoid

  • Mixes up the message format with the transport Answering with stdio or HTTP details misses the question. The messages are JSON-RPC 2.0 objects, and the transport only frames and delivers them.
  • Says every message gets a response A notification has a method and no id, and the receiver sends nothing back. Leaving out the third shape shows a shallow read of JSON-RPC.
  • Lets a response carry both result and error A response holds exactly one of result or error, tied to the request by id. Say that plainly and give the error fields: code, message, optional data.
  • Says MCP still supports JSON-RPC batching Early revisions allowed batching, but the 2025-06-18 revision removed it. Say that it was removed and in which revision.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Model Context Protocol (MCP) cheatsheet.

← Back to all Model Context Protocol (MCP) questions
Pro · $10/mo

49 of 56 Model Context Protocol (MCP) answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime