AI Hints
Home›MCP Tutorial›Building Blocks
MCP · Lesson 5 of 120

Messages Underneath

JSON-RPC.

⏱ 2 min read▶ Video at 3:44🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

Under the hood, clients and servers send each other small JSON messages. The format is called JSONRPC. Each request has a method name, and parameters, and gets a matching response.

Messages Underneath
From the video: Messages Underneath
  • Small JSON messages
  • JSON-RPC
  • Request and response

A tool call message

Here's the request a client sends to call a tool. The method is tools slash call. The params name the tool, and its arguments. The ID matches the response to the request.

request.jsonjson
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "order_status",
    "arguments": {"order_id": 1042}
  }
}

The response

The response has the same ID. Its result holds the content, here one piece of text. And is error says whether the tool failed.

response.jsonjson
{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "content": [{"type": "text", "text": "shipped"}],
    "isError": false
  }
}

Summary

MCP messages are JSONRPC requests and responses, matched by ID. The SDK writes them for us. Next, transports.

Key takeaways
  • method
  • params
  • id
Next up: Transports — stdio and HTTP