Skip to content

fix(tools): add AllowPaths support to list_files tool#140

Open
quansang wants to merge 1 commit intonextlevelbuilder:mainfrom
quansang:fix/list-files-allowed-prefixes
Open

fix(tools): add AllowPaths support to list_files tool#140
quansang wants to merge 1 commit intonextlevelbuilder:mainfrom
quansang:fix/list-files-allowed-prefixes

Conversation

@quansang
Copy link

@quansang quansang commented Mar 11, 2026

Summary

Fixes #143

The list_files tool was missing the PathAllowable interface implementation that read_file already had. This caused access denied: path outside workspace errors when agents tried to list files in skill directories.

Problem

  • read_file can access skill directories via AllowPaths() whitelist
  • list_files lacks this capability and fails with permission errors
  • Agents cannot browse skill directory structures

Solution

  • Add allowedPrefixes field to ListFilesTool struct
  • Add AllowPaths() method to implement PathAllowable interface
  • Use resolvePathWithAllowed() instead of resolvePath() in Execute()
  • Add wiring in gateway.go to allow list_files access to skills directories

Changes

  • internal/tools/filesystem_list.go: +9 lines
  • cmd/gateway.go: +14 lines

Verification

go build ./...  # ✓ Compiles successfully
go vet ./internal/tools/...  # ✓ No issues

Checklist

  • Code compiles successfully
  • Static analysis passes (go vet)
  • Follows existing code patterns (matches read_file implementation)
  • Minimal changes focused on the fix

The list_files tool was missing the PathAllowable interface implementation
that read_file already had. This caused "access denied: path outside workspace"
errors when agents tried to list files in skill directories.

Changes:
- Add allowedPrefixes field to ListFilesTool struct
- Add AllowPaths() method to implement PathAllowable interface
- Use resolvePathWithAllowed() instead of resolvePath() in Execute()
- Add wiring in gateway.go to allow list_files access to skills directories

Fixes: list_files can now access paths outside workspace that are
whitelisted via AllowPaths(), matching read_file behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_files tool missing AllowPaths support for skill directories

1 participant