MCPcopy Index your code
hub / github.com/docker/docker-agent / filterAllowedTools

Function filterAllowedTools

pkg/runtime/loop.go:1229–1240  ·  view source on GitHub ↗

filterAllowedTools keeps only tools whose names match an entry in allowed (filepath.Match-style glob, falling back to an exact match). An empty allow-list imposes no restriction. Used by fork-mode skill sub-sessions that declare an allowed-tools list.

(agentTools []tools.Tool, allowed []string)

Source from the content-addressed store, hash-verified

1227// allow-list imposes no restriction. Used by fork-mode skill sub-sessions
1228// that declare an allowed-tools list.
1229func filterAllowedTools(agentTools []tools.Tool, allowed []string) []tools.Tool {
1230 if len(allowed) == 0 {
1231 return agentTools
1232 }
1233 filtered := make([]tools.Tool, 0, len(agentTools))
1234 for _, t := range agentTools {
1235 if toolNameMatchesAny(t.Name, allowed) {
1236 filtered = append(filtered, t)
1237 }
1238 }
1239 return filtered
1240}
1241
1242// toolNameMatchesAny reports whether name matches any of the patterns. Each
1243// pattern is tried as a filepath.Match glob; a malformed pattern falls back

Callers 2

skillSubSessionToolsMethod · 0.85
TestFilterAllowedToolsFunction · 0.85

Calls 1

toolNameMatchesAnyFunction · 0.85

Tested by 1

TestFilterAllowedToolsFunction · 0.68