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

Function Test_clientSupportsUI

pkg/github/ui_capability_test.go:30–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func Test_clientSupportsUI(t *testing.T) {
31 t.Parallel()
32 ctx := context.Background()
33
34 t.Run("client with UI extension", func(t *testing.T) {
35 caps := &mcp.ClientCapabilities{}
36 caps.AddExtension("io.modelcontextprotocol/ui", map[string]any{
37 "mimeTypes": []string{"text/html;profile=mcp-app"},
38 })
39 req := createMCPRequestWithCapabilities(t, caps)
40 assert.True(t, clientSupportsUI(ctx, &req))
41 })
42
43 t.Run("client without UI extension", func(t *testing.T) {
44 req := createMCPRequestWithCapabilities(t, &mcp.ClientCapabilities{})
45 assert.False(t, clientSupportsUI(ctx, &req))
46 })
47
48 t.Run("client with nil capabilities", func(t *testing.T) {
49 req := createMCPRequestWithCapabilities(t, nil)
50 assert.False(t, clientSupportsUI(ctx, &req))
51 })
52
53 t.Run("nil request", func(t *testing.T) {
54 assert.False(t, clientSupportsUI(ctx, nil))
55 })
56
57 t.Run("nil session", func(t *testing.T) {
58 req := createMCPRequest(nil)
59 assert.False(t, clientSupportsUI(ctx, &req))
60 })
61}
62
63func Test_clientSupportsUI_fromContext(t *testing.T) {
64 t.Parallel()

Callers

nothing calls this directly

Calls 3

clientSupportsUIFunction · 0.85
createMCPRequestFunction · 0.85

Tested by

no test coverage detected