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

Function WithReadOnlyFilter

pkg/teamloader/readonly.go:13–19  ·  view source on GitHub ↗

WithReadOnlyFilter wraps a toolset so it only lists and exposes tools whose annotations carry a read-only hint. Every other tool is filtered out, so the agent can never call a mutating tool from this toolset. When readOnly is false the inner toolset is returned unchanged.

(inner tools.ToolSet, readOnly bool)

Source from the content-addressed store, hash-verified

11// agent can never call a mutating tool from this toolset. When readOnly is
12// false the inner toolset is returned unchanged.
13func WithReadOnlyFilter(inner tools.ToolSet, readOnly bool) tools.ToolSet {
14 if !readOnly {
15 return inner
16 }
17
18 return &readOnlyTools{ToolSet: inner}
19}
20
21type readOnlyTools struct {
22 tools.ToolSet

Calls

no outgoing calls