From 37c223fcb59ffa3bc160f933643f852005d0f9e4 Mon Sep 17 00:00:00 2001 From: asketeddy Date: Mon, 26 Oct 2026 03:31:20 +0900 Subject: [PATCH] docs: clarify LoggingTransport log contents Explain that LoggingTransport re-encodes JSON-RPC messages and does not preserve the original byte stream. Point stdio byte-level diagnostics to the underlying IOTransport readers and writers, and regenerate the corresponding guide. --- docs/troubleshooting.md | 7 ++++++- internal/docs/troubleshooting.src.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 950eef727..5d9c8d941 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -22,7 +22,12 @@ SDK, as well as inspecting MCP traffic. ## Collecting MCP logs For [stdio](protocol.md#stdio-transport) transport connections, you can also -inspect MCP traffic using a `LoggingTransport`: +inspect JSON-RPC messages using a `LoggingTransport`: + +`LoggingTransport` logs re-encoded JSON-RPC messages, not the original byte +stream. Whitespace, JSON member order, and transport framing can differ from +the transmitted bytes. To inspect the exact stdio bytes, record the underlying +reads and writes, for example at the `Reader` and `Writer` of an `IOTransport`. ```go func ExampleLoggingTransport() { diff --git a/internal/docs/troubleshooting.src.md b/internal/docs/troubleshooting.src.md index 83342032a..7ff064807 100644 --- a/internal/docs/troubleshooting.src.md +++ b/internal/docs/troubleshooting.src.md @@ -21,7 +21,12 @@ SDK, as well as inspecting MCP traffic. ## Collecting MCP logs For [stdio](protocol.md#stdio-transport) transport connections, you can also -inspect MCP traffic using a `LoggingTransport`: +inspect JSON-RPC messages using a `LoggingTransport`: + +`LoggingTransport` logs re-encoded JSON-RPC messages, not the original byte +stream. Whitespace, JSON member order, and transport framing can differ from +the transmitted bytes. To inspect the exact stdio bytes, record the underlying +reads and writes, for example at the `Reader` and `Writer` of an `IOTransport`. %include ../../mcp/transport_example_test.go loggingtransport -