From 089178e9bd787d743f643f135bbf55f7ba27fa5d Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Wed, 30 Jul 2025 17:45:27 +0000 Subject: [PATCH] mcp: remove unused functions (cleanup) Remove a few functions that were flagged by gopls as unused. We can always add them back if necessary. --- mcp/mcp_test.go | 14 -------------- mcp/server.go | 4 ---- 2 files changed, 18 deletions(-) diff --git a/mcp/mcp_test.go b/mcp/mcp_test.go index 4c728107..819edeb6 100644 --- a/mcp/mcp_test.go +++ b/mcp/mcp_test.go @@ -520,17 +520,6 @@ func handleEmbeddedResource(_ context.Context, _ *ServerSession, params *ReadRes }, nil } -// Add calls the given function to add the named features. -func add[T any](m map[string]T, add func(...T), names ...string) { - for _, name := range names { - feat, ok := m[name] - if !ok { - panic("missing feature " + name) - } - add(feat) - } -} - // errorCode returns the code associated with err. // If err is nil, it returns 0. // If there is no code, it returns -1. @@ -837,9 +826,6 @@ func traceCalls[S Session](w io.Writer, prefix string) Middleware[S] { } } -// A function, because schemas must form a tree (they have hidden state). -func falseSchema() *jsonschema.Schema { return &jsonschema.Schema{Not: &jsonschema.Schema{}} } - func nopHandler(context.Context, *ServerSession, *CallToolParamsFor[map[string]any]) (*CallToolResult, error) { return nil, nil } diff --git a/mcp/server.go b/mcp/server.go index 9b823e7f..220c28d3 100644 --- a/mcp/server.go +++ b/mcp/server.go @@ -423,10 +423,6 @@ func (s *Server) lookupResourceHandler(uri string) (ResourceHandler, string, boo // Lexical path traversal attacks, where the path has ".." elements that escape dir, // are always caught. Go 1.24 and above also protects against symlink-based attacks, // where symlinks under dir lead out of the tree. -func (s *Server) fileResourceHandler(dir string) ResourceHandler { - return fileResourceHandler(dir) -} - func fileResourceHandler(dir string) ResourceHandler { // Convert dir to an absolute path. dirFilepath, err := filepath.Abs(dir)