mcp: remove unused functions (cleanup) (#207)
Remove a few functions that were flagged by gopls as unused. We can always add them back if necessary.
This commit is contained in:
parent
bacca7a1d2
commit
9f48a04971
2 changed files with 0 additions and 18 deletions
|
|
@ -520,17 +520,6 @@ func handleEmbeddedResource(_ context.Context, _ *ServerSession, params *ReadRes
|
||||||
}, nil
|
}, 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.
|
// errorCode returns the code associated with err.
|
||||||
// If err is nil, it returns 0.
|
// If err is nil, it returns 0.
|
||||||
// If there is no code, it returns -1.
|
// 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) {
|
func nopHandler(context.Context, *ServerSession, *CallToolParamsFor[map[string]any]) (*CallToolResult, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
// 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,
|
// are always caught. Go 1.24 and above also protects against symlink-based attacks,
|
||||||
// where symlinks under dir lead out of the tree.
|
// where symlinks under dir lead out of the tree.
|
||||||
func (s *Server) fileResourceHandler(dir string) ResourceHandler {
|
|
||||||
return fileResourceHandler(dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
func fileResourceHandler(dir string) ResourceHandler {
|
func fileResourceHandler(dir string) ResourceHandler {
|
||||||
// Convert dir to an absolute path.
|
// Convert dir to an absolute path.
|
||||||
dirFilepath, err := filepath.Abs(dir)
|
dirFilepath, err := filepath.Abs(dir)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue