Skip to content

Commit 2308c29

Browse files
authored
Merge pull request #4373 from pragneshbagary/glob_issue
Fix #4173: glob returns an error instead of an empty list
2 parents dd55035 + 39851ba commit 2308c29

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

hack/bats/tests/mcp.bats

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ tools_call() {
296296
}
297297

298298
@test 'glob returns an empty list when the pattern does not match' {
299-
skip "see https://github.com/lima-vm/lima/issues/4173"
300-
299+
301300
tools_call glob '{"pattern":"nothing.to.see"}'
302301

303302
run_yq '.structuredContent.matches[]' <<<"$output"

pkg/mcp/toolset/filesystem.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ func (ts *ToolSet) Glob(_ context.Context,
130130
}
131131
pattern := path.Join(guestPath, args.Pattern)
132132
matches, err := ts.sftp.Glob(pattern)
133+
if matches == nil {
134+
matches = []string{}
135+
}
133136
if err != nil {
134137
return nil, nil, err
135138
}

0 commit comments

Comments
 (0)