docs/server: fix logging defaults and the SetLoggingLevel method name - #1251
Open
rishabhsai wants to merge 1 commit into
Open
docs/server: fix logging defaults and the SetLoggingLevel method name#1251rishabhsai wants to merge 1 commit into
rishabhsai wants to merge 1 commit into
Conversation
The logging section said "for stateful sessions" twice in a row with opposite meanings, so one of the two sentences had to be wrong. The default of "info" is set only in `StreamableHTTPHandler.ephemeralConnectOpts` (mcp/streamable.go), which applies to stateless requests; a session built through `Server.Connect` starts with an empty level, and `ServerSession.Log` returns early until the client sets one, which is what the first sentence already says. The section also told readers to call `SetLevel`, but that is not an exported method: the client-side call is `ClientSession.SetLoggingLevel`, so the pkg.go.dev anchor the page linked to does not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Logging section of docs/server.md says "For stateful sessions" twice in a row with opposite meanings, so one of the two sentences has to be wrong. The default level of "info" is set in only one place in the SDK,
StreamableHTTPHandler.ephemeralConnectOptsin mcp/streamable.go, which handles stateless requests; a session created throughServer.Connectstarts with an emptyServerSessionState.LogLevel, andServerSession.Logreturns early while the level is empty, which is exactly what the first sentence already says. The second sentence now reads "For stateless sessions". The same section also tells readers to callSetLevel, but there is no such exported method: the client-side call isClientSession.SetLoggingLevel, andsetLevelis only the unexported server handler, so the pkg.go.dev link on the page points at an anchor that does not exist. For context, the stateless default arrived in #411 and the paragraph describing it was written later in #497, which is where the duplicated "stateful" came from.Checked with
go doc ./mcp ClientSession(onlySetLoggingLevelis exported) andgrep -rn 'LogLevel = "info"' mcp/(a single hit, mcp/streamable.go:516); docs/server.md was regenerated withgo generate ./internal/docs, andgo build ./... && go test ./...pass.