The JSON-RPC Envelope
A server that has never talked to you before still has to know, from this one message alone, whether you expect an answer, which protocol version you speak, and where your metadata ends and your arguments begin. Classify any 2026-07-28 message on the wire as a request, a notification, a result response, or an error response, and state the id rule that makes each one what it is. Explain what resultType means, why complete and inputrequired are the two core values, and how a client must treat an unrecognized or an absent one. Validate a meta key name against the prefix and name grammar, and tell a reserved MCP prefix from a merely similar one by checking its second label, not its first. Name the reserved meta keys a request, a notification, and a result each carry, and the one exception the prefix rule makes for OpenTelemetry trace context. Explain why a request missing a required meta field is rejected with -32602, and why no two MCP messages ever travel together in one batch. Lesson 02 showed one client discovering two servers it had never seen before and calling a tool on each. Underneath that exchange sits a smaller, sharper question the exam expects you to answer without hesitating: handed an arbitrary bag of JSON that just arrived over stdio…
The JSON-RPC Envelope: A server that has never talked to you before still has to know, from this one message alone, whether you expect an answer, which…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.