We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
According to the MCP spec, the data that may be logged can be of any type.
/** * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. */ data: unknown;
MCP Schema
You can even see an example here.
However, ctx.info and friends have message typed as str:
ctx.info
str
async def info(self, message: str, **extra: Any) -> None:
Even so, the underlying ServerSession.send_log_message does indicate that data is Any type:
ServerSession.send_log_message
Any
async def send_log_message( self, level: types.LoggingLevel, data: Any, logger: str | None = None ) -> None:
And so does LoggingMessageNotificationParams:
LoggingMessageNotificationParams
data: Any """ The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. """
Also, it is unclear what the extra parameters should be for.
extra
To Reproduce Just look at the source file:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/fastmcp/server.py#L703
Expected behavior This library should follow the spec and allow any JSON serializable type to be logged.
For example, this should work without giving a type error:
ctx.info({"test": "Hello World!"})
MCP servers can use logging to send rich notifications back to the client.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context
mcp 1.4.1
The text was updated successfully, but these errors were encountered:
Do you mind taking a stab at it and sending a PR
Sorry, something went wrong.
Hey @dsp-ant, can I contribute to this issue?
Plan on contributing to mcp in the future as well. This good first issue will help me start capture a good understanding of the repo
mcp
good first issue
@AshwanthramKL Just signed on to do it but saw your PR. Awesome - thank you for contributing! 👍
I have added a pr to solve this. #400 @dsp-ant
No branches or pull requests
Describe the bug
According to the MCP spec, the data that may be logged can be of any type.
MCP Schema
You can even see an example here.
However,
ctx.info
and friends have message typed asstr
:Even so, the underlying
ServerSession.send_log_message
does indicate that data isAny
type:And so does
LoggingMessageNotificationParams
:Also, it is unclear what the
extra
parameters should be for.To Reproduce
Just look at the source file:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/fastmcp/server.py#L703
Expected behavior
This library should follow the spec and allow any JSON serializable type to be logged.
For example, this should work without giving a type error:
MCP servers can use logging to send rich notifications back to the client.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
mcp 1.4.1
The text was updated successfully, but these errors were encountered: