Skip to content

Fix: Change context logging methods to accept Any type per MCP spec#2399

Closed
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:fix/logging-types-spec-compliant
Closed

Fix: Change context logging methods to accept Any type per MCP spec#2399
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:fix/logging-types-spec-compliant

Conversation

@internet-dot
Copy link
Copy Markdown

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

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
@Kludex
Copy link
Copy Markdown
Member

Kludex commented Apr 7, 2026

@Kludex Kludex closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context logging function types are not spec compliant

2 participants