Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions mcp/mcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions mcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading