Skip to content

Commit c810be4

Browse files
authored
fix: distinguish between nil and non-nil allowed tools (#977)
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 <[email protected]>
1 parent ce6afe2 commit c810be4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/mcp/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (l *Local) Close() error {
181181
}
182182

183183
func (l *Local) sessionToTools(ctx context.Context, session *Session, toolName string, allowedTools []string) ([]types.Tool, error) {
184-
allToolsAllowed := len(allowedTools) == 0 || slices.Contains(allowedTools, "*")
184+
allToolsAllowed := allowedTools == nil || slices.Contains(allowedTools, "*")
185185

186186
tools, err := session.Client.ListTools(ctx, mcp.ListToolsRequest{})
187187
if err != nil {

0 commit comments

Comments
 (0)