MCP JSON-RPC 2.0 Message Format
The request, response, notification, and error message shapes MCP uses for every client-server exchange, and the standard error codes.
Quick Answer / TL;DR
Every MCP message is JSON-RPC 2.0: a request carries an id, method, and params and expects a matching response; a notification has no id and expects no response; an error response uses a standard numeric code such as -32602 for invalid params. Getting this shape right is what makes a server interoperable with any MCP client.
Key Takeaways
- Requests and responses are correlated by a shared id field; notifications omit id and get no response.
- Standard JSON-RPC error codes (-32700 to -32603) cover transport-level failures; tool-specific failures use isError: true in a normal result instead.
- Always include jsonrpc: "2.0" — a client can reject a message missing it.
Request, response, and notification shapes
A request expects a response with a matching id. A notification is fire-and-forget: no id, and the server must not reply to it.
// Request
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": { "name": "get_weather", "arguments": { "location": "Mumbai" } } }
// Response
{ "jsonrpc": "2.0", "id": 1,
"result": { "content": [{ "type": "text", "text": "28C, Partly Cloudy" }] } }
// Notification (no id, no response expected)
{ "jsonrpc": "2.0", "method": "notifications/initialized" }Standard error codes
Reserve these codes for transport and protocol-level failures. A tool that fails for a business reason (bad input, downstream API down) should usually return a normal result with isError: true and a clear text message instead, so the model sees it as content rather than a raw protocol error.
| Code | Meaning |
|---|---|
| -32700 | Parse error — malformed JSON |
| -32600 | Invalid request — not a valid JSON-RPC object |
| -32601 | Method not found |
| -32602 | Invalid params |
| -32603 | Internal error |
MCP JSON-RPC 2.0 Message Format FAQs
Direct answers for developers, operators, and Indian teams evaluating MCP.