Fix: Change context logging methods to accept Any type per MCP spec#2399
Closed
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
Closed
Fix: Change context logging methods to accept Any type per MCP spec#2399internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
The MCP spec defines the logging data field as 'unknown' (any JSON serializable type), but the context logging methods (debug, info, warning, error, log) only accepted str. This prevented sending structured log data like dicts or lists. Changed message parameter type from str to Any in all logging methods. Removed the extra parameter since callers can now pass structured data directly as the message. Fixes modelcontextprotocol#397
Member
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 MCP spec defines the logging data field as 'unknown' (any JSON serializable type), but the context logging methods (debug, info, warning, error, log) only accepted str. This prevented sending structured log data like dicts or lists.
Changed message parameter type from str to Any in all logging methods. Removed the extra parameter since callers can now pass structured data directly as the message.
Fixes #397