feat: add UI preload and result-driven close controls - #751
Open
sunnymitramsft wants to merge 1 commit into
Open
feat: add UI preload and result-driven close controls#751sunnymitramsft wants to merge 1 commit into
sunnymitramsft wants to merge 1 commit into
Conversation
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.
Summary
_meta.ui.preloadwith"optional"(default) and"disabled"modes_meta["ui/close"]on tool results for invocation-scoped View suppression or teardowngetToolUiPreload,shouldCloseToolUi, andUI_CLOSE_META_KEYfor host and server integrationsMotivation
A server may only know after executing a tool whether a View adds value. Separate UI and non-UI tools do not solve cases where both variants represent the same intent and accept the same arguments, such as
search_orders(query)returning one exact match, several possible matches, or no matches.This keeps UI discovery early enough for host optimization while allowing servers to defer loading and suppress or close a View when the result can be presented without it.
Compatibility
The change is additive. Existing
resourceUribehavior remains the default, omitted or unrecognized preload modes resolve to"optional", hosts may ignore metadata they do not recognize, and no new RPC method or transport behavior is introduced.Validation
npm run buildnpm exec bun test src(290 passed)npm exec bun test src/app-bridge.test.ts(156 passed)typedoc --treatValidationWarningsAsErrors --emit nonenpm testcompleted with 377 passed and 2 skipped; 2 unrelated PDF-server tests could not create directory symlinks on Windows (EPERM) before their assertions ran.Closes #744.
Follow-up to modelcontextprotocol/modelcontextprotocol#3260, which was moved here per MCP Apps Working Group guidance.