Day 2: JSON-RPC and messages – requests, responses, errors, versions
Goal: be able to read and hand-write every MCP message, know the error codes and understand how protocol versions are negotiated – including with clients that still speak the old handshake · Duration: approx. 2 h · Prerequisite: Day 1 (server
leitstand.py)
Where we start
You check in two steps whether the server from Day 1 responds. First you send it the first message from Day 1 and save the response in a file:
# on cp1, in ~/mcpa/tag01
(head -1 nachrichten.jsonl; sleep 3) | uv run python leitstand.py > stand.jsonlhead -1 nachrichten.jsonloutputs only the first line – theserver/discoverrequest.sleep 3keeps the line open for three seconds so the server can respond (Day 1).> stand.jsonlwrites the server’s response to a file instead of the screen.
Then you read the first supported version from the response:
# on cp1, in ~/mcpa/tag01
jq -r '.result.supportedVersions[0]' stand.jsonl.result.supportedVersions[0]is the first element of thesupportedVersionslist.-routputs text without quotes.
Expected:
2026-07-28
If leitstand.py or nachrichten.jsonl is
missing, create them as in Day 1, Drills 1 and 2.
Introduction
Yesterday you sent three messages by hand and got three responses. Today you look more closely: how is a message built, which fields are required, what happens when one is missing, and which error codes come back? To find out, you deliberately provoke errors – a wrong protocol version, missing required fields, an unknown method, broken arguments – and read what the server responds.
That sounds dry, but it is the foundation for everything that follows. If you can read an error code, you find bugs in minutes instead of hours. And the exam likes to ask exactly this: which code for which case, which fields a request must carry, how client and server agree on a version.
Today you learn:
- the four message types of JSON-RPC 2.0: request, result, error, notification,
- the rules for the identifier
id, - the required fields in
_metaand the reserved namespaceio.modelcontextprotocol/, - the JSON-RPC error codes and the new MCP codes
-32020to-32022, - how protocol versions work and how a server serves new and old clients at the same time,
- what a server does with messages it cannot understand.
Background
The picture for today: order slips in the hotel
Since Day 1, MCP has been a hotel for you: the front desk (host) takes the guests’ requests, and for every external service provider (server) – laundry, taxi, flower shop – there is a house line (client). Today is about how people talk over that line: with forms that must be filled in strictly.
- A request is an order slip with an
order number (
id). Without a number the front desk wouldn’t know which order a delivery belongs to. - A result is the delivery note with the same order number.
- An error is a return slip: the same number plus a reason code – “form filled in wrong”, “service doesn’t exist”, “form edition outdated”.
- A notification is a notice on the bulletin board: no number, and nobody replies to it.
_metais the header of every order slip: which form edition (protocol version) and what the front desk itself can do (capabilities). Since 2026-07-28 this header is on every slip.- In the past (until 2025-11-25), the front desk and the provider signed a framework contract once (handshake); after that, informal slips were enough.
The terms
| Term | Meaning | in the picture |
|---|---|---|
| Request | message with id, method,
params; requires exactly one response |
order slip with order number |
| Result | response with the same id and result |
delivery note |
| Error | response with the same id and error
(code, message, data) |
return slip with reason code |
| Notification | message without id, never answered |
notice on the bulletin board |
_meta |
required details in every request: version, capabilities | header of the order slip |
| Protocol version | date of the form edition, e.g. 2026-07-28 |
form edition |
Handshake (initialize) |
old connection setup until 2025-11-25 | framework contract |
Remember: Every order slip carries a number and a complete header. Anything without a number is a notice – nobody replies to it.
JSON-RPC 2.0 in five minutes
JSON-RPC is a lean protocol for remote function
calls (“remote procedure call”). Every message is a JSON object with the
field "jsonrpc": "2.0". There are four types:
| Type | Fields | Response? |
|---|---|---|
| Request | id, method, params |
yes, exactly one |
| Result | id, result |
– |
| Error | id, error with code,
message, optional data |
– |
| Notification | method, params, no
id |
no, never |
A response contains either result
or error, never both. Via the
id, the sender matches the response to its request. In MCP,
fixed rules apply to the id:
- It is a number or a string, never
null. - A sender must not use the same
idfor two open requests. - The response returns the same
idwith the same type.
Notifications have no id because nobody is supposed to
answer – for example “cancel request 99”. JSON-RPC also knows
batches, that is, several messages in one JSON array.
MCP doesn’t allow that: each message stands on its own.
The error codes
JSON-RPC defines five error codes. MCP uses them and adds its own:
| Code | Name | When |
|---|---|---|
-32700 |
Parse error | message is not valid JSON |
-32600 |
Invalid Request | valid JSON, but not a valid request |
-32601 |
Method not found | method doesn’t exist |
-32602 |
Invalid params | parameters wrong or missing – also: unknown tool, unknown resource |
-32603 |
Internal error | error in the server |
-32020 |
HeaderMismatch | HTTP headers don’t match the body (Day 8) |
-32021 |
MissingRequiredClientCapability | the client lacks a capability the server needs |
-32022 |
UnsupportedProtocolVersion | server doesn’t speak the requested protocol version |
Since 2026-07-28 the ranges are clearly divided: -32000
to -32019 are older, implementation-specific codes, and no
new ones are assigned there; -32020 to -32099
are reserved for MCP. You should know two moves, because older sources
give the old values: “resource not found” was -32002 and is
now -32602; the three MCP codes above used to be
-32001, -32003 and -32004.
_meta: what every request brings along
Since 2026-07-28 there is no connection setup anymore. What used to
be negotiated once per session is now in every request
under params._meta:
| Key | Required? | Content |
|---|---|---|
io.modelcontextprotocol/protocolVersion |
yes | version the client speaks for this request |
io.modelcontextprotocol/clientCapabilities |
yes | client capabilities, {} for none |
io.modelcontextprotocol/clientInfo |
recommended | name and version of the client |
io.modelcontextprotocol/logLevel |
optional | from which level the server should send log messages |
Responses carry the key
io.modelcontextprotocol/serverInfo in
result._meta. All keys starting with
io.modelcontextprotocol/ belong to the protocol. Your own
metadata is allowed but needs its own prefix in reverse
domain notation, for example de.itdrills/ticket. For
distributed tracing, the specification has also defined the keys
traceparent, tracestate and
baggage from OpenTelemetry (Day 14).
Every result also carries resultType:
complete for a finished result, input_required
if the server first wants a follow-up request answered (Day 10). If
resultType is missing – for example with an old server – a
client must assume complete.
Versions
Protocol versions are dates in the format
YYYY-MM-DD: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25,
2026-07-28. A new version appears when the protocol changes
incompatibly. Negotiation is simple:
- The client sends the version it wants to speak in
_meta. - If the server supports it, it responds normally.
- If it doesn’t, it responds with
-32022and lists the versions it supports inerror.data.supported. The client picks one of them and repeats the request.
If you want to know in advance what a server can do, call
server/discover – the response contains
supportedVersions.
Old and new clients on the same server
Up to 2025-11-25 every connection began with a
handshake: an initialize request with
version and capabilities, a response with the server’s version, then the
notification notifications/initialized. After that,
requests carried no version anymore.
Many hosts still speak this way. A server can therefore serve
both eras. With stdio, the first
message of a connection decides: if it starts with
initialize, the connection runs in the old style; if it
carries the new _meta fields, in the new style. A new
client checks with server/discover whether the server
supports the new version, and otherwise falls back to
initialize – you saw this with the SDK client on Day 1.
Drill 1: A version the server doesn’t know
Where you are: on cp1, in the directory
~/mcpa/tag02.What you have afterwards: the error response
-32022and the list of versions the server supports.
Step 1 – The directory. Today you work in a directory of your own.
# on cp1
mkdir -p ~/mcpa/tag02-palso creates missing parent directories and reports no error if the directory already exists.
# on cp1
cd ~/mcpa/tag02Step 2 – Copy the server. You work with a copy of the server from Day 1 so the original stays unchanged.
# on cp1, in ~/mcpa/tag02
cp ~/mcpa/tag01/leitstand.py .- The dot
.at the end means “here, into the current directory”.
Step 3 – An order slip with the wrong form edition.
The request is valid except for the version 1999-01-01.
Create it in a file:
# on cp1, in ~/mcpa/tag02
nano version.jsonl{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"1999-01-01","io.modelcontextprotocol/clientCapabilities":{}}}}The whole request is on one line – stdio separates messages at the end of a line (Day 1).
Step 4 – Send it. You save the response in a file so you can read it calmly afterwards:
# on cp1, in ~/mcpa/tag02
(cat version.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > version-antwort.jsonl(cat version.jsonl; sleep 4)sends the file and keeps the line open for four seconds.2>/dev/nulldiscards the server’s messages on stderr.> version-antwort.jsonlwrites the response to a file.
Step 5 – Read the return slip.
jq .error shows only the error object of the response:
# on cp1, in ~/mcpa/tag02
jq .error version-antwort.jsonlExpected:
{
"code": -32022,
"message": "Unsupported protocol version",
"data": {
"supported": [
"2026-07-28"
],
"requested": "1999-01-01"
}
}
The server responds with -32022, and data
tells the client everything it needs to continue: requested
is the requested version, supported the list of possible
ones. A client takes the newest version from the list that it supports
itself and sends the request again – with a new
id, because the old one has been answered.
Remember: Outdated form edition → return slip
-32022, listing the editions the provider accepts (data.supported). Then: new version, new order number.
Save your progress? Sign up for free
Drill 2: Missing required fields
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: two error messages that say exactly what is missing in
_meta.
Step 1 – Three order slips, two with an incomplete header.
# on cp1, in ~/mcpa/tag02
nano ohne-meta.jsonl{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
{"jsonrpc":"2.0","id":3,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}The first line is a complete, modern request – it establishes that
this connection runs in the new style (more on that in Drill 6). Line 2
has no _meta at all, line 3 only the version.
Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat ohne-meta.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > ohne-meta-antwort.jsonlStep 3 – Only the responses to lines 2 and 3. The response to the first request doesn’t matter here:
# on cp1, in ~/mcpa/tag02
jq -c 'select(.id != 1)' ohne-meta-antwort.jsonlselect(…)keeps only objects for which the condition is true;!=means “not equal”.-cprints each object compactly on one line.
Expected:
{"jsonrpc":"2.0","id":2,"error":{"code":-32602,"message":"params._meta must be an object carrying the required 'io.modelcontextprotocol/protocolVersion' and 'io.modelcontextprotocol/clientCapabilities' envelope keys"}}
{"jsonrpc":"2.0","id":3,"error":{"code":-32602,"message":"params._meta is missing the required envelope key(s): io.modelcontextprotocol/clientCapabilities"}}
Both times -32602 (Invalid params), with a message
naming the missing field. The specification calls the required fields in
_meta the envelope of a request. Over HTTP
you would additionally get status code 400 (Day 8).
Remember: If the header lacks version or capabilities,
-32602comes back – with the name of the missing field in the message.
Save your progress? Sign up for free
Drill 3: Methods that don’t exist
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: the code
-32601– and the realization thatpingno longer exists.
Step 1 – Two orders for services that don’t exist.
# on cp1, in ~/mcpa/tag02
nano methode.jsonl{"jsonrpc":"2.0","id":4,"method":"werkzeuge/liste","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
{"jsonrpc":"2.0","id":5,"method":"ping","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat methode.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > methode-antwort.jsonlStep 3 – Number and reason.
# on cp1, in ~/mcpa/tag02
jq -c '{id, error}' methode-antwort.jsonl{id, error}builds a new object from just two fields of the response – short for{"id": .id, "error": .error}.
Expected:
{"id":4,"error":{"code":-32601,"message":"Method not found","data":"werkzeuge/liste"}}
{"id":5,"error":{"code":-32601,"message":"Method not found","data":"ping"}}
The first method is made up (werkzeuge/liste,
“tools/list” in German). The second existed until 2025-11-25: with
ping you checked whether the other side was still alive. In
2026-07-28 it has been removed – without sessions there
is no connection that would need to be kept alive. Likewise removed are
logging/setLevel and
notifications/roots/list_changed. Method names follow the
pattern area/action: tools/list,
tools/call, resources/read,
prompts/get, server/discover.
Remember: Unknown method →
-32601.pingno longer exists since 2026-07-28 – without a session nobody needs to check whether the line is still up.
Save your progress? Sign up for free
Drill 4: Wrong arguments – protocol error or execution error?
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: both error types from Day 1 compared side by side.
Step 1 – Two incorrectly filled-in orders.
# on cp1, in ~/mcpa/tag02
nano argumente.jsonl{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"freier_speicher","arguments":"falsch","_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"freier_speicher","arguments":{"pfad":42},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}- In line 1,
argumentsis a string ("falsch", “wrong”) instead of an object – the request itself is built incorrectly. - In line 2,
argumentsis an object, butpfadis a number instead of a string – the request is built correctly, only the value doesn’t match the tool’s schema.
Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat argumente.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > argumente-antwort.jsonlStep 3 – What kind of response? For each response:
number, error object and isError:
# on cp1, in ~/mcpa/tag02
jq -c '{id, error, isError: .result.isError}' argumente-antwort.jsonlisError: .result.isErrorcreates the fieldisErrorin the new object and fills it from.result.isError; if there is noresult, it isnull.
Step 4 – The explanation for the second order.
# on cp1, in ~/mcpa/tag02
jq -r 'select(.id == 7) | .result.content[0].text' argumente-antwort.jsonlselect(.id == 7)keeps only the response withid7;|passes it on to the next expression..result.content[0].textgets the text of the first content block;[0]is the first element of a list.
Expected (step 3, then step 4):
{"id":6,"error":{"code":-32602,"message":"Invalid request parameters","data":""},"isError":null}
{"id":7,"error":null,"isError":true}
Error executing tool freier_speicher: 1 validation error for freier_speicherArguments
pfad
Input should be a valid string [type=string_type, input_value=42, input_type=int]
For further information visit https://errors.pydantic.dev/2.14/v/string_type
This is exactly what the specification wants:
- A request that doesn’t match the structure of
tools/callis a protocol error: JSON-RPC error-32602, noresult(henceisError: null). - Arguments that don’t match the
inputSchemaare an execution error:resultwithisError: trueand an explanation incontent. The model gets to see the message and can try again with a string instead of a number.
The message comes from Pydantic, the library the SDK uses to validate arguments against the schema. For a model it is understandable enough; for humans it is somewhat technical.
Remember: Badly built slip → return slip (
-32602). Correctly built slip with an unsuitable value → delivery note withisError: trueand an explanation the model can learn from.
Save your progress? Sign up for free
Drill 5: Notifications, identifiers and custom metadata
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: proof that notifications go unanswered, identifiers may also be text, and custom
_metakeys are allowed.
Step 1 – A notice and two orders.
# on cp1, in ~/mcpa/tag02
nano kennungen.jsonl{"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":99}}
{"jsonrpc":"2.0","id":"anfrage-a","method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
{"jsonrpc":"2.0","id":8,"method":"tools/call","params":{"name":"freier_speicher","arguments":{},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{},"de.itdrills/ticket":"INC-4711"}}}- Line 1 is a notification: no
id.notifications/cancelledasks to cancel the request withid99 – which doesn’t even exist here. - Line 2 uses the string
"anfrage-a"as itsid. - Line 3 carries a custom metadata key
de.itdrills/ticketwith its own prefix.
Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat kennungen.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > kennungen-antwort.jsonlStep 3 – Which numbers came back?
# on cp1, in ~/mcpa/tag02
jq -c '{id, resultType: .result.resultType}' kennungen-antwort.jsonlExpected:
{"id":"anfrage-a","resultType":"complete"}
{"id":8,"resultType":"complete"}
Three messages, two responses: the notification goes
unanswered, even though it refers to an unknown request. The string
comes back unchanged as the id. The server silently
accepted the custom key – peers may ignore unknown metadata with their
own prefix.
Since 2026-07-28, cancellation via
notifications/cancelled exists only over
stdio. Over HTTP a client cancels by closing the response’s
connection (Day 9).
Remember: Nobody replies to a notice (notification). Order numbers may be text, and custom header fields need a prefix of their own such as
de.itdrills/.
Save your progress? Sign up for free
Drill 6: The old handshake
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: a connection in the 2025-11-25 style and a comparison of the responses.
This is how a client spoke until 2025-11-25 – and how many hosts still speak today:
Step 1 – Framework contract and informal slip.
# on cp1, in ~/mcpa/tag02
nano alt.jsonl{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"alter-client","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}initializecarries version, capabilities and client info as normal parameters, not in_meta.notifications/initializedtells the server: “Handshake done, let’s go.”tools/listthen has no parameters at all.
Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat alt.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > alt-antwort.jsonlStep 3 – Which fields do the responses have?
# on cp1, in ~/mcpa/tag02
jq -c '{id, keys: (.result | keys)}' alt-antwort.jsonl(.result | keys)lists the field names of the result alphabetically; insidejq,|passes a value on to the next expression.
Expected:
{"id":1,"keys":["capabilities","instructions","protocolVersion","serverInfo"]}
{"id":2,"keys":["tools"]}
The same server serves the old client without you changing anything.
The responses look different, though: the response to
initialize names the negotiated
protocolVersion and serverInfo directly in the
result, and tools/list returns only tools –
without resultType, ttlMs,
cacheScope and _meta. The first message locked
the connection into the old era.
And this works in both directions. If, on a connection that began
with a request without _meta, you later
send a modern request, the server rejects it with -32600:
“this connection serves the handshake protocol era”. That is why
ohne-meta.jsonl in Drill 2 began with a complete modern
request.
Remember: The first message decides:
initialize→ old framework contract for the whole connection,_meta→ new style. A server can serve both eras, but never mixed on one connection.
Save your progress? Sign up for free
Drill 7: What the server doesn’t answer at all
Where you are: on cp1, in
~/mcpa/tag02.What you have afterwards: two messages that get no response – and the lesson from that.
Step 1 – Three slips, two of them unusable.
# on cp1, in ~/mcpa/tag02
nano kaputt.jsonl{"jsonrpc":"2.0","id":9,"method":"tools/list"
[{"jsonrpc":"2.0","id":10,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}]
{"jsonrpc":"2.0","id":11,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}Line 1 is not valid JSON – the closing brace is missing. Line 2 is a batch: a valid request, but wrapped in an array. Line 3 is correct.
Step 2 – Send and save.
# on cp1, in ~/mcpa/tag02
(cat kaputt.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > kaputt-antwort.jsonlStep 3 – Which numbers came back?
# on cp1, in ~/mcpa/tag02
jq -c '{id, resultType: .result.resultType}' kaputt-antwort.jsonlExpected:
{"id":11,"resultType":"complete"}
Only the third message is answered. The server discards the batch
request because MCP doesn’t allow batches. For unreadable JSON, JSON-RPC
actually prescribes the response -32700 with
"id": null; Python SDK 2.3.0 silently discards such lines
instead. For you as a developer this means: if a response
doesn’t arrive, first check whether your message is valid JSON
– for example with jq -c . datei.jsonl, which names line
and column on an error.
Remember: This server doesn’t answer unreadable JSON or batches at all. If a response doesn’t arrive, check the slip itself first:
jq -c . datei.jsonl.
Save your progress? Sign up for free
If it doesn’t work
- No output at all (the response file is empty): the
server was terminated before it could respond. Increase
sleep 4. If that doesn’t help, leave out2>/dev/nulland read what the server reports on stderr. -32600“this connection serves the handshake protocol era”: the first message of the connection had no_meta, so the server speaks the old style. Start the file with a complete modern request.jq: error … Cannot index string: ajqfilter accesses a field that doesn’t exist in this response, for example.result.contentin an error response. Display the whole response withjq -c ..parse errorfromjqwhen checking a.jsonlfile: a typo in a line.jq -c . datei.jsonlnames line and column.
Exercise: Discover with your own identifier (15 min)
Write a server/discover request with the identifier
"erkundung-1" and your own clientInfo (name
uebung, version 0.1). Print only
id and supportedVersions.
Solution
# on cp1, in ~/mcpa/tag02
nano uebung.jsonl{"jsonrpc":"2.0","id":"erkundung-1","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"uebung","version":"0.1"}}}}# on cp1, in ~/mcpa/tag02
(cat uebung.jsonl; sleep 4) | uv run python leitstand.py 2>/dev/null > uebung-antwort.jsonl# on cp1, in ~/mcpa/tag02
jq -c '{id, v: .result.supportedVersions}' uebung-antwort.jsonlExpected:
{"id":"erkundung-1","v":["2026-07-28"]}
Save your progress? Sign up for free
Challenge: Versions without discover (10 min)
Suppose a server has older behavior where
server/discover doesn’t help. How do you find out with
one single request which protocol versions it
supports?
Solution
Send any request with a version that doesn’t exist – as in Drill 1.
The server must respond with -32022 and list its versions
in error.data.supported. That is exactly what the field is
for: a client should be able to continue after a version error without
guessing.
Save your progress? Sign up for free
Checkpoint
The response files from the drills are still in the directory. You read them once more:
# on cp1, in ~/mcpa/tag02
jq .error.code version-antwort.jsonlExpected: -32022
# on cp1, in ~/mcpa/tag02
jq -c '[.id, .error.code]' methode-antwort.jsonlExpected:
[4,-32601]
[5,-32601]
# on cp1, in ~/mcpa/tag02
jq -r 'select(.id == 1) | .result.protocolVersion' alt-antwort.jsonlExpected: 2025-11-25
Exam questions
1. A client sends a JSON-RPC message without an
id field. What is it, and what does the server respond?
- a faulty request; the server responds with
-32600
- a faulty request; the server responds with
- a notification; the server doesn’t respond
- a request with
id0; the server responds normally
- a request with
- a batch; the server responds with an array
2. A server only supports 2026-07-28,
the client requests 2025-03-26. What is the correct
response from the server?
-32601Method not found
- a normal result in the 2026-07-28 style
-32022withdata.supportedanddata.requested
-32603Internal error
3. Which information must every
request carry in params._meta since 2026-07-28?
protocolVersionandclientCapabilitiesunder the prefixio.modelcontextprotocol/
- a session ID and the protocol version
clientInfoandserverInfo
- nothing;
_metais always optional
- nothing;
4. tools/call is called with
"arguments": {"anzahl": "drei"}, while the schema requires
a number. How does a server report this according to the
specification?
- JSON-RPC error
-32602
- JSON-RPC error
- JSON-RPC error
-32700
- JSON-RPC error
- result with
isError: trueand an explanation incontent
- result with
- result with
resultType: "input_required"
- result with
5. A developer wants to send custom metadata. Which key is chosen correctly?
io.modelcontextprotocol/ticket
ticket
com.example/ticket
_ticket
Solutions
- B. Without an
idit is a notification; nobody responds to it – not even with an error. - C. Since 2026-07-28,
UnsupportedProtocolVersionhas the code-32022;datanames the possible versions and the requested one. - A. Version and client capabilities are required,
clientInfois recommended. Sessions (B) no longer exist. - C. Values that don’t match the
inputSchemaare execution errors, so that the model can correct itself.-32602(A) applies when the request itself is built incorrectly or the tool is unknown. - C. Custom keys need their own prefix in reverse
domain notation. The prefix
io.modelcontextprotocol/(A) is reserved for the protocol.
Interview Note
“Why did MCP remove the handshake?” – Because state on the server is expensive. With sessions, every request from a client had to land on the same server instance that remembered version and capabilities; load balancers needed “sticky sessions”, and restarts lost sessions. If every request carries everything it needs, any instance can answer any request – servers can be scaled like an ordinary HTTP service.
Enterprise Note
In larger environments, hosts and servers of different generations
run side by side. So plan servers that speak both eras as long as hosts
with initialize are still in use, and watch in the logs
which protocol versions actually arrive. Custom metadata such as a
ticket number or a cost center in _meta (with your own
prefix) is a simple way to link calls in the audit log to a case (Day
14).
Summary
- JSON-RPC 2.0 knows request, result, error and notification;
notifications have no
idand no response. Batches are not allowed in MCP. - The
idis a number or text, nevernull, and comes back unchanged in the response. - Every request carries the required fields
protocolVersionandclientCapabilitiesin_meta; the prefixio.modelcontextprotocol/belongs to the protocol, custom keys need their own. - Important codes:
-32601method unknown,-32602parameters wrong (also unknown tool, unknown resource),-32022version not supported (withsupported/requested),-32020header error,-32021missing client capability. - Schema violations in arguments are execution errors
(
isError: true), broken requests are protocol errors. - Versions are dates; a server can serve old (
initialize) and new clients – with stdio, the first message decides. ping,logging/setLevelandnotifications/roots/list_changedno longer exist in 2026-07-28.
Commands at a glance
For review: all commands and messages of this day with the parameters you used.
| Command / message | What it does | Parameters |
|---|---|---|
mkdir -p <directory> |
creates a directory | -p also parent directories, no error if it exists |
nano <file>.jsonl |
create messages in a file, one per line | – |
(cat <file>; sleep 4) \| uv run python leitstand.py 2>/dev/null > <response>.jsonl |
sends messages over stdio and saves the responses | 2>/dev/null discard stderr, > into a
file |
jq .error <file> ·
jq .error.code <file> |
error object · only the code | . path into the object |
jq -c '{id, error}' |
new object from selected fields | {a, b} = {"a": .a, "b": .b} |
jq -c 'select(.id != 1)' |
filters responses | select(bedingung), ==,
!= |
jq -r '… \| .result.content[0].text' |
text of the first content block | [0] first element, -r without quotes |
jq -c '(.result \| keys)' |
field names of an object | keys sorted |
> <file> |
save output to a file | – |
| Request | {"jsonrpc":"2.0","id":…,"method":…,"params":{…,"_meta":{…}}} |
id number or text |
| Notification | {"jsonrpc":"2.0","method":"notifications/…","params":{…}} |
no id |
notifications/cancelled |
cancels a request (stdio only) | requestId |
initialize +
notifications/initialized |
old handshake until 2025-11-25 | protocolVersion, capabilities,
clientInfo |