Ā© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Converting messages to AI-SDK format (v1 Client) - Mastra
M
Mastra
ā¢
4mo ago
ā¢
9 replies
Sebastian
Converting messages to AI-SDK format (v1 Client)
When using
client.listThreadMessages
client.listThreadMessages
to retrieve message history
, the messages are now returned as
MastraDBMessage
MastraDBMessage
.
To use them to populate initial messages in
useChat
useChat
they need to be converted to AISdkV5 format
, because it expects the messages to be
UI_MESSAGE
UI_MESSAGE
.
It seems the method needed to do that
exists
, but is currently
not exported
(only the chunk
-based conversion for streaming is
)
.
Would this be the correct way or am I missing something
?
I just tried to replicate what I found in the
playground UI
and adapt it
.
Thanks in advance for any help
!
Mastra
Join
The TypeScript Agent FrameworkFrom the team that brought you Gatsby: prototype and productionize AI features with a modern JavaScript stack.
5,321
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Duplicated messages from ai-sdk
M
Mastra / help-bugs-problems
4mo ago
When using client tools with `addToolOutput` from ai-sdk, messages get duplicated.
M
Mastra / help-bugs-problems
2mo ago
Mastra vNext Network Stream Format Incompatibility with AI SDK
M
Mastra / help-bugs-problems
7mo ago