✂️ refactor: Artifacts and Tool Callbacks to Pass UI Resources#9581
Merged
danny-avila merged 4 commits intodevfrom Sep 11, 2025
Merged
✂️ refactor: Artifacts and Tool Callbacks to Pass UI Resources#9581danny-avila merged 4 commits intodevfrom
danny-avila merged 4 commits intodevfrom
Conversation
Contributor
|
Thanks @danny-avila, I find the PR cleaner with your follow-up changes! Also, thank you for 2 things:
I appreciate how you've been taking some our suggestions into account here for smoother collaboration, this means a lot. Thanks! |
8 tasks
arbreton
pushed a commit
to arbreton/LibreChat
that referenced
this pull request
Oct 9, 2025
…-avila#9581) * ✂️ refactor: use artifacts and callbacks to pass UI resources * chore: imports * refactor: Update UIResource type imports and definitions across components and tests * refactor: Update ToolCallInfo test data structure and enhance TAttachment type definition --------- Co-authored-by: Samuel Path <samuel.path@shopify.com>
Guiraud
pushed a commit
to Guiraud/LibreChat
that referenced
this pull request
Nov 21, 2025
…-avila#9581) * ✂️ refactor: use artifacts and callbacks to pass UI resources * chore: imports * refactor: Update UIResource type imports and definitions across components and tests * refactor: Update ToolCallInfo test data structure and enhance TAttachment type definition --------- Co-authored-by: Samuel Path <samuel.path@shopify.com>
8 tasks
patricksn3ll
pushed a commit
to patricksn3ll/LibreChat
that referenced
this pull request
Dec 11, 2025
…-avila#9581) * ✂️ refactor: use artifacts and callbacks to pass UI resources * chore: imports * refactor: Update UIResource type imports and definitions across components and tests * refactor: Update ToolCallInfo test data structure and enhance TAttachment type definition --------- Co-authored-by: Samuel Path <samuel.path@shopify.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Originally #9472
Summary
By @samuelpath
I recently shipped the 2 followings PRs to enable a basic integration with MCP-UI:
The approach I took to pass the UI resources received from the MCP Server tool response to the front-end was to use a content item of type
textand passing the UI resources array in a newmetadataproperty.This worked but the issue is that these content items of type
textare passed as such the LLMs. We have been lucky so far since all the LLM providers we've tested silently ignored this unknownmetadataproperty. But there is no guarantee that all providers do, nor that existing providers could enforce stricter payload checks.In order to work around this, we proposed the following PR in the Agents package: danny-avila/agents#16. It would remove the
metadataproperty just before the call to the LLM would be made. However, this was rightly rejected by @danny-avila who explained that there was a better way, using callbacks.This PR now uses @danny-avila's recommended approach with the callbacks.
Here's the idea:
Tools.ui_resourcesToolCalltoToolCallInfoToolCallInfoto render themChange Type
Testing
See the 2 PRs mentioned above. The behaviour tested is the same.
Test Configuration:
Checklist
Please delete any irrelevant options.