From 331e43ec659454ad13f4792b5fb2cc3c8d8a1b9d Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 May 2025 10:11:16 -0400 Subject: [PATCH] fix: distinguish between nil and non-nil allowed tools If allowedTools is nil, then all tools are allowed. If allowed tools is non-nil and has length zero, then no tools are allowed. Signed-off-by: Donnie Adams --- pkg/mcp/loader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/mcp/loader.go b/pkg/mcp/loader.go index f3dffcf6..c9f1b8a3 100644 --- a/pkg/mcp/loader.go +++ b/pkg/mcp/loader.go @@ -181,7 +181,7 @@ func (l *Local) Close() error { } func (l *Local) sessionToTools(ctx context.Context, session *Session, toolName string, allowedTools []string) ([]types.Tool, error) { - allToolsAllowed := len(allowedTools) == 0 || slices.Contains(allowedTools, "*") + allToolsAllowed := allowedTools == nil || slices.Contains(allowedTools, "*") tools, err := session.Client.ListTools(ctx, mcp.ListToolsRequest{}) if err != nil {