
Lesson 2: Standardizing Tool Communication
Master the messages of the protocol. Learn the lifecycle of an MCP request, from capability discovery to tool invocation, and how standardizing these messages ensures system reliability.
Module 5: Model Context Protocol (MCP)
Lesson 2: Standardizing Tool Communication
How do the Client and the Server actually talk? MCP is built on top of JSON-RPC 2.0. This means it uses a standard, lightweight messaging format that is easy for both humans and AI to parse.
In this lesson, we look at the lifecycle of an MCP interaction and the three "Standard Message Types" that every architect must recognize.
1. The Handshake (Capabilities Discovery)
When an MCP client connects to a server, the first thing they do is a Handshake.
- The Client asks: "What can you do?"
- The Server responds: "I have these 3 Tools, these 2 Resources, and this 1 Prompt."
Why this is better than custom tools:
In custom tool design (Module 4), you have to manually code the "Discovery" logic. In MCP, it's automatic. The moment a server is added, the model instantly "Knows" its capabilities.
2. Standard Message Type 1: Resources
A Resource is passive data. It's something the agent can read but not act upon.
- Example: A file, a log, or a specific database row.
- MCP Message:
resources/list->resources/read.
3. Standard Message Type 2: Tools
A Tool is an active function (Module 4). It has side effects.
- Example: "Create a meeting," "Post to Slack."
- MCP Message:
tools/list->tools/call.
4. Standard Message Type 3: Prompts
An MCP server can provide Pre-written Prompts.
- Example: A server for "Code Review" might provide a prompt template that tells the model exactly what to look for in a PR.
- MCP Message:
prompts/get.
5. Visualizing the Message Flow
sequenceDiagram
participant C as MCP Client
participant S as MCP Server
C->>S: initialize (capabilities=JSON)
S-->>C: version + tools + resources
Note over C,S: Handshake Complete
C->>S: tools/call (name="search", args={"q": "AI"})
S->>S: Runs Local Search Logic
S-->>C: result (JSON Data)
6. Summary
- MCP uses JSON-RPC for message transport.
- The Handshake automates tool discovery.
- Resources, Tools, and Prompts are the three unified building blocks of communication.
In the next lesson, we look at where these servers live: MCP in Distributed Systems.
Interactive Quiz
- What protocol is MCP built upon?
- What is the difference between an MCP "Resource" and an MCP "Tool"?
- Why is the "Initialize" step important for model intelligence?
- Scenario: You add a new file to a folder monitored by an MCP server. Does the MCP client need a code change to see that new file? Why or why not?
Reference Video: