Repository navigation
Omit app-only ui_get unless the client advertises MCP Apps - #3687
Open
vshalpnjabi wants to merge 6 commits into
Open
vshalpnjabi wants to merge 6 commits into
vshalpnjabi wants to merge 6 commits into
Conversation
Remote tools/list already parses client capabilities into MCPMethodInfo, but the strip decision only checked the HasUISupport context flag, which HTTP never sets. Clients that sent empty capabilities still received ui_get. Honor parsed ClientCapabilities and omit app-only tools unless the client advertises extensions["io.modelcontextprotocol/ui"].
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the capability-based filtering of the app-only ui_get tool.
No open issues 🎉
What changed in this PR
Addresses #3683 by using parsed client capabilities to omit the app-only ui_get tool from clients without MCP Apps support, avoiding unnecessary tool exposure to the model.
Changes:
- Falls back to parsed capabilities when the explicit UI-support flag is absent, preserving behavior when capabilities are unknown.
- Adds tests for capability-based metadata stripping and
ui_getvisibility.
| File | Description |
|---|---|
pkg/inventory/registry.go |
Adds capability-based fallback to the MCP Apps metadata-stripping decision. |
pkg/inventory/registry_test.go |
Tests stripping with and without the MCP Apps extension. |
pkg/github/ui_tools_test.go |
Verifies ui_get visibility based on parsed client capabilities. |
Review effort: Balanced (auto)
kraigmills-stack
approved these changes
Nov 6, 2026
Author
|
@SamMorrowDrums @omgitsads Friendly ping — this has one approval and green checks. Ready for a maintainer look when you have a minute. Thanks! |
Stdio registers tools before initialize, so client capabilities are not available at registration. Filter app-only tools such as ui_get per session at tools/list from the client's declared capabilities.
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
Do not list the app-only
ui_gettool to clients that lack MCP Apps support, on both the remote (HTTP) server and the local stdio server.Why
ui_getis marked_meta.ui.visibility: ["app"]. Apps hosts hide that from the model; other clients ignore the meta and hand the helper to the model, wasting tokens.A client that supports Apps declares
extensions["io.modelcontextprotocol/ui"]. The remote server already parses those capabilities ontools/list, but the strip path only checked theHasUISupportcontext flag, which HTTP never set. Empty capabilities therefore still listedui_get. Stdio registers tools beforeinitialize, so client capabilities aren't known at registration andui_getwas always listed there too (reported on the issue for v2.1.0stdio --toolsets all).What changed
shouldStripMCPAppsMetadatanow treats parsedClientCapabilitiesas an explicit capability source: noio.modelcontextprotocol/uiextension → omit app-only tools; extension present → keepui_get.tools/listfrom the session's declared capabilities, following the existing availability middleware pattern.ui_getstays callable for MCP App views.Lint & tests
go build ./...,go test ./..../script/lint(0 issues)Test_UIGet_ListedOnlyWhenClientAdvertisesMCPAppsCapabilityAI-assisted; I reviewed the full diff and ran the tests myself.
Fixes #3683