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

Function startedToolNames

pkg/runtime/runtime.go:929–945  ·  view source on GitHub ↗

startedToolNames returns the live tool names of ts, but only when it is a started toolset; the boolean is false for not-yet-started toolsets so the caller can fall back to the declared allow-list. context.TODO is safe here: the toolset is already started, so listing returns its cached tools without

(ctx context.Context, ts tools.ToolSet)

Source from the content-addressed store, hash-verified

927// the toolset is already started, so listing returns its cached tools without
928// a cancellable round-trip.
929func startedToolNames(ctx context.Context, ts tools.ToolSet) ([]string, bool) {
930 s, ok := tools.As[*tools.StartableToolSet](ts)
931 if !ok || !s.IsStarted() {
932 return nil, false
933 }
934 tl, err := s.Tools(ctx)
935 if err != nil {
936 return nil, false
937 }
938 names := make([]string, 0, len(tl))
939 for i := range tl {
940 if tl[i].Name != "" {
941 names = append(names, tl[i].Name)
942 }
943 }
944 return names, true
945}
946
947// declaredToolNames maps each configured toolset's display name to its declared
948// `tools:` allow-list. The key matches the registry's naming

Callers 1

toolsetDetailsFunction · 0.85

Calls 2

IsStartedMethod · 0.65
ToolsMethod · 0.65

Tested by

no test coverage detected