MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / FilteredCopy

Method FilteredCopy

tools/registry.go:104–124  ·  view source on GitHub ↗
(allow, deny map[string]struct{}, readOnlyOnly, enabledOnly bool)

Source from the content-addressed store, hash-verified

102}
103
104func (r *ToolRegistry) FilteredCopy(allow, deny map[string]struct{}, readOnlyOnly, enabledOnly bool) *ToolRegistry {
105 filtered := NewToolRegistry()
106 for _, tool := range r.ListTools() {
107 if enabledOnly && !tool.IsEnabled() {
108 continue
109 }
110 if allow != nil {
111 if _, ok := allow[tool.Name()]; !ok {
112 continue
113 }
114 }
115 if _, ok := deny[tool.Name()]; ok {
116 continue
117 }
118 if readOnlyOnly && !tool.IsReadOnly(nil) {
119 continue
120 }
121 filtered.Register(tool)
122 }
123 return filtered
124}
125
126func (r *ToolRegistry) GetDeferredTools() map[string]Tool {
127 return r.deferred.GetAll()

Callers 4

buildForkRegistryFunction · 0.80
queryLoopMethod · 0.80
ExecuteOneRequestMethod · 0.80
BuildFilteredRegistryFunction · 0.80

Calls 6

ListToolsMethod · 0.95
RegisterMethod · 0.95
NewToolRegistryFunction · 0.85
IsEnabledMethod · 0.65
NameMethod · 0.65
IsReadOnlyMethod · 0.65

Tested by

no test coverage detected