リクエスト、レスポンス、通知
MCPが日々やり取りする3種類のメッセージ形式について学びます。
「リクエスト、レスポンス、通知」はCoddyKit上の無料MCP Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMCP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MCP Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Three Shapes of Talk
Under the hood, MCP speaks JSON-RPC. Every exchange is just one of three message shapes, and once you know them the wire stops feeling like magic.
What Is a Request?
A request asks the other side to do something and expects an answer. It carries an id so the reply can be matched back to it later.
{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}The Reply Comes Back
A response answers exactly one request. It echoes the same id, so the client always knows which question it is replying to.
{"jsonrpc": "2.0", "id": 1, "result": {"tools": []}}Fire and Forget
A notification is a one-way heads-up. It looks like a request but has no id, so nobody sends a reply back.
{"jsonrpc": "2.0", "method": "notifications/initialized"}The id Is the Tell
The presence of an id is the whole difference: with an id you owe a reply, without one you do not. That single field separates requests from notifications.
Both Sides Can Ask
JSON-RPC is symmetric, so MCP is too. The server can send requests to the client, not just the other way around. Both parties play both roles.
Result or Error, Never Both
Every response carries either a result or an error, never both. Success fills result; failure fills error. You always know which one to read.
Notifications Power Updates
MCP uses notifications for live signals like progress, logs, and list changes. No reply is needed, so they keep the conversation flowing freely.
Matching by id
Because each request carries a unique id, many calls can be in flight at once. Replies need not arrive in order; the id keeps everything paired.
A Tiny Round Trip
Picture a round trip: the client requests tools/list, the server answers with the same id, and then the client knows which tools exist.
Why Three Is Enough
These three shapes cover everything MCP needs: ask and wait, answer, or announce. That simplicity is why JSON-RPC was chosen for the protocol.
Quick Check
You spot a JSON-RPC message with no id field. What kind is it?
Recap: Three Shapes
You learned MCP's whole vocabulary: requests ask with an id, responses answer with that id, and notifications announce with no id at all. Three shapes, endless conversations.
よくある質問
「リクエスト、レスポンス、通知」レッスンは無料ですか?
はい。「リクエスト、レスポンス、通知」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MCP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MCP Academyコースには全4レッスンが含まれています。
「リクエスト、レスポンス、通知」で何を学びますか?
MCPが日々やり取りする3種類のメッセージ形式について学びます。 ブラウザで直接実行するハンズオンコードでMCP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
MCP Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMCP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「リクエスト、レスポンス、通知」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMCP Academyレッスンでコードを書いて実行できますか?
はい。すべてのMCP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- リクエスト、レスポンス、通知
- JSON-RPC呼び出しの構造
- 初期化ハンドシェイク
- 通信上のエラーを読み解く