Skip to content

Commit 089178e

Browse files
committed
mcp: remove unused functions (cleanup)
Remove a few functions that were flagged by gopls as unused. We can always add them back if necessary.
1 parent bacca7a commit 089178e

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

mcp/mcp_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -520,17 +520,6 @@ func handleEmbeddedResource(_ context.Context, _ *ServerSession, params *ReadRes
520520
}, nil
521521
}
522522

523-
// Add calls the given function to add the named features.
524-
func add[T any](m map[string]T, add func(...T), names ...string) {
525-
for _, name := range names {
526-
feat, ok := m[name]
527-
if !ok {
528-
panic("missing feature " + name)
529-
}
530-
add(feat)
531-
}
532-
}
533-
534523
// errorCode returns the code associated with err.
535524
// If err is nil, it returns 0.
536525
// If there is no code, it returns -1.
@@ -837,9 +826,6 @@ func traceCalls[S Session](w io.Writer, prefix string) Middleware[S] {
837826
}
838827
}
839828

840-
// A function, because schemas must form a tree (they have hidden state).
841-
func falseSchema() *jsonschema.Schema { return &jsonschema.Schema{Not: &jsonschema.Schema{}} }
842-
843829
func nopHandler(context.Context, *ServerSession, *CallToolParamsFor[map[string]any]) (*CallToolResult, error) {
844830
return nil, nil
845831
}

mcp/server.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,6 @@ func (s *Server) lookupResourceHandler(uri string) (ResourceHandler, string, boo
423423
// Lexical path traversal attacks, where the path has ".." elements that escape dir,
424424
// are always caught. Go 1.24 and above also protects against symlink-based attacks,
425425
// where symlinks under dir lead out of the tree.
426-
func (s *Server) fileResourceHandler(dir string) ResourceHandler {
427-
return fileResourceHandler(dir)
428-
}
429-
430426
func fileResourceHandler(dir string) ResourceHandler {
431427
// Convert dir to an absolute path.
432428
dirFilepath, err := filepath.Abs(dir)

0 commit comments

Comments
 (0)