MCP 2025-11-25 · LOCAL EXCHANGE
MCP message flow: correlate requests and replies
Edit a real local sum, compare reply ordering and expose unmatched or malformed responses.
Exchange inputs
Message trace and client state
Pending request IDs
Selected state evidence
Inspect a computed exchange
This local fixture serializes MCP-shaped JSON messages and executes a bounded arithmetic tool in JavaScript. It is pinned to revision 2025-11-25 and opens no network connection, process, SDK or model session. The trace shows each direction, the current wire object and the client pending-request table. The tool name is known in advance, allowing tools/list and tools/call to be outstanding together. Listing is not a prerequisite for calling a known tool in this experiment.
Control readiness and identity
Send initialized toggles the client readiness notification. Turn it off and Finish: initialization itself completes, but this fixture holds both ordinary requests. Request ID is JSON, so enter 3 for a numeric ID or "3" for a string ID. They are distinct keys. Numeric 1 and 2 are reserved for initialization and listing; reusing either is rejected before this local run starts. Null, fractional numbers and integers outside JavaScript safe-integer range are also rejected. The safe-integer bound is an implementation limit of this page. Invalid local input produces no simulated wire traffic.
Change real tool arguments
Tool arguments accepts a JSON object. At defaults, sum receives a=2 and b=3 and returns five in text and structured content. Change the values to negative four and nine, then Finish to obtain five by a different calculation. Change only b to ten and the output becomes six. Both fields must be numbers within plus or minus one million, with no extra fields. A string instead of a number produces a tool result with isError=true; it is still a matched response. Broken JSON or an array fails the local editor boundary before a request exists. The tool uses ordinary JavaScript floating-point addition, so decimal rounding is possible.
Separate server rejection from a tool failure
Tool name selects the real local sum operation or an unknown name. Unknown name returns a protocol error with code -32602 in this fixture. In contrast, a sum argument outside its documented bounds yields a successful JSON-RPC envelope carrying an unsuccessful tool result. Neither outcome leaves the call pending when its response ID matches. The distinction helps separate dispatch problems from feedback a caller could use to correct tool inputs. There is no filesystem, payment, remote API or other persistent side effect.
Compare response arrival orders
Response order chooses listing first or calling first while request order remains unchanged. At defaults the call reply arrives before the list reply. Step through the trace and observe that only the corresponding pending row disappears. Both orders finish with the same sum and the same discovered tool schema. Arrival position never decides which request owns a result. The initialization notification has no ID and does not create a pending row; this trace deliberately generates no reply for it.
Inject correlation and envelope faults
Call reply fault affects only the call response. Unknown ID preserves the pending call because the incoming key is absent. Change ID type converts a numeric ID to its string spelling; a string ID becomes numeric zero, which is distinct from every string. Duplicate reply first completes the call and then rejects the repeated reply without applying the result again. Both result and error creates an invalid envelope and keeps the original call pending. Try each with ID 3 and inspect the rejected-reply count, pending table and selected JSON. These faults alter replies after local calculation, so a rejected reply does not mean the server never computed the sum.
Replay evidence at a readable pace
Play reveals the trace over sixty inspection seconds. Pause freezes it, Speed selects half, normal or double pace, Next event advances one transition, and Finish reveals the end. Timeline scrubs and pauses; Restart rewinds the same inputs. Restore defaults also resets normal speed. Editing any scenario input immediately rebuilds the trace and rewinds playback, so an old successful answer cannot survive a changed input. Backgrounding the page pauses playback. Equal event spacing is for reading and does not represent network latency or computation time.
Use the experiment within its limits
Unmatched requests stay pending at the end of the recording; a real client needs a timeout policy, which is outside this lesson. The model omits batching, partial byte reads, transport framing, cancellation, authentication, pagination, server-to-client requests and general JSON Schema evaluation. It checks one fixed arithmetic schema and generated response faults, not arbitrary MCP compliance. All evidence is available as selectable text, and direction and state remain understandable without color. Consult the related readings for architecture and the pinned references for wire requirements before implementing a production client.
References: MCP base protocol, session lifecycle, tools and error results, and JSON-RPC 2.0.