Hello,
When the tool response contains an artifact, it has the type
from mcp.types import EmbeddedResource, ImageContent
NonTextContent = ImageContent | EmbeddedResource
and appears in the ToolMessage as something like:
ToolMessage(
content=...,
name=...,
id=...,
tool_call_id=...,
artifact=[
EmbeddedResource(
type="resource",
resource=TextResourceContents(
uri=AnyUrl("https://example.com/"),
mimeType=None,
meta=None,
text=...
)
)
]
)
The problem occurs when I use this tool inside a ReAct agent together with a checkpointer.
In this case, I get the following error:
TypeError: Type is not msgpack serializable: ToolMessage
It seems this happens because of the required uri field, which is of type AnyUrl, and msgpack cannot serialize it directly.