MCPcopy Index your code
hub / github.com/github/github-mcp-server / clientSupportsUI

Function clientSupportsUI

pkg/github/ui_capability.go:21–35  ·  view source on GitHub ↗

clientSupportsUI reports whether the MCP client that sent this request supports MCP Apps UI rendering. It checks the context first (set by HTTP/stateless servers from stored session capabilities), then falls back to the go-sdk Session (for stdio).

(ctx context.Context, req *mcp.CallToolRequest)

Source from the content-addressed store, hash-verified

19// It checks the context first (set by HTTP/stateless servers from stored
20// session capabilities), then falls back to the go-sdk Session (for stdio).
21func clientSupportsUI(ctx context.Context, req *mcp.CallToolRequest) bool {
22 // Check context first (works for HTTP/stateless servers)
23 if supported, ok := ghcontext.HasUISupport(ctx); ok {
24 return supported
25 }
26 // Fall back to go-sdk session (works for stdio/stateful servers)
27 if req != nil && req.Session != nil {
28 params := req.Session.InitializeParams()
29 if params != nil && params.Capabilities != nil {
30 _, hasUI := params.Capabilities.Extensions[mcpAppsExtensionKey]
31 return hasUI
32 }
33 }
34 return false
35}
36
37// uiSubmitted reports whether the call is itself an MCP App form submission.
38// The form re-invokes its tool with _ui_submitted=true; such calls must execute

Callers 3

shouldDeferToFormFunction · 0.85
Test_clientSupportsUIFunction · 0.85

Calls

no outgoing calls

Tested by 2

Test_clientSupportsUIFunction · 0.68