diff --git a/tool/mcptool/mcp.go b/tool/mcptool/mcp.go index 28ebd695..081857e2 100644 --- a/tool/mcptool/mcp.go +++ b/tool/mcptool/mcp.go @@ -1,8 +1,9 @@ // Copyright (c) Microsoft. All rights reserved. // Package mcp provides integration with the Model Context Protocol (MCP). -// It allows agents to connect to external MCP servers via stdio, HTTP, or WebSocket -// and expose their tools and prompts as agent.Tool instances. +// It allows agents to connect to external MCP servers via stdio (subprocess) +// or HTTP (SSE / streamable HTTP) and expose their tools as +// tool.Tool / tool.FuncTool instances. package mcptool import ( diff --git a/tool/mcptool/mcp_test.go b/tool/mcptool/mcp_test.go index 28738253..6465951e 100644 --- a/tool/mcptool/mcp_test.go +++ b/tool/mcptool/mcp_test.go @@ -7,6 +7,8 @@ import ( "encoding/base64" "encoding/json" "errors" + "os" + "path/filepath" "strings" "testing" @@ -1026,3 +1028,27 @@ func TestAddToolTypedNilContentDoesNotPanic(t *testing.T) { t.Fatalf("content = %#v, want a TextContent containing \"null\"", contents[0]) } } + +// TestPackageDocNoWebSocket guards against re-introducing the inaccurate +// claim that mcptool supports a WebSocket transport. Connect only wraps an +// mcp.Transport supplied by the pinned go-sdk, which offers stdio and HTTP +// (SSE / streamable HTTP) transports but no WebSocket transport. +func TestPackageDocNoWebSocket(t *testing.T) { + entries, err := os.ReadDir(".") + if err != nil { + t.Fatalf("ReadDir(.) error = %v", err) + } + for _, e := range entries { + name := e.Name() + if e.IsDir() || !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") { + continue + } + data, err := os.ReadFile(filepath.Join(".", name)) + if err != nil { + t.Fatalf("ReadFile(%s) error = %v", name, err) + } + if strings.Contains(strings.ToLower(string(data)), "websocket") { + t.Errorf("%s mentions WebSocket, but the go-sdk provides no WebSocket transport", name) + } + } +}