When I call a tool the execute function runs. The returned data is fed to AI as well used for UI. For example if I have a web search tool it will send search results.
Now for UI rendering let’s say to make it beautiful I need favicon and some other metadata, which has nothing to do with AI’s context.
But the problem is if I strip data in execute function’s return, the AI and UI both doesn’t get it. I am new to programming and AI SDK. Please help.
How can I make that the tool return enough data for AI context and extra data for a beautiful rich transparent UI while the data persist across sessions.