I’m building a ChatGPT App where each user message triggers a tool call that returns a widget (via _meta.ui.resourceUri). The problem is that the old widget from the previous message stays visible in the conversation, and the new widget appears below it. I want the previous widget to close/collapse when the new one renders — similar to how Adobe Photoshop behaves in ChatGPT (only one active widget visible at a time).
What I’ve considered:
openai/closeWidget: truein_meta— from the docs this seems to close the widget of the current tool response, not a previous one.window.openai.requestClose()— the widget can close itself, but I’m not sure how the old widget would know a new tool call happened.- Listening for
ui/notifications/tool-input— does ChatGPT broadcast this notification to all mounted widgets of the same app, or only to the widget associated with the current tool call? If all widgets receive it, I could callrequestClose()in the old widget when it gets atool-inputfor a new tool call.
Questions:
- What is the recommended pattern for “single active widget” behavior — where only the latest widget is visible and previous ones are hidden?
- Does
ui/notifications/tool-inputget delivered to previously rendered widgets of the same app? - Is there another mechanism I’m missing?