MCPcopy
hub / github.com/docker/docker-agent / stopToolSets

Function stopToolSets

cmd/root/run.go:1108–1114  ·  view source on GitHub ↗

stopToolSets gracefully stops all tool sets with a bounded timeout so that cleanup cannot block indefinitely. It detaches from ctx's cancellation (cleanup often runs after the caller's ctx is already done, e.g. on shutdown or tab close) while keeping ctx's trace context.

(ctx context.Context, t toolStopper)

Source from the content-addressed store, hash-verified

1106// cancellation (cleanup often runs after the caller's ctx is already done,
1107// e.g. on shutdown or tab close) while keeping ctx's trace context.
1108func stopToolSets(ctx context.Context, t toolStopper) {
1109 ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
1110 defer cancel()
1111 if err := t.StopToolSets(ctx); err != nil {
1112 slog.ErrorContext(ctx, "Failed to stop tool sets", "error", err)
1113 }
1114}
1115
1116// validateTheme reports whether ref names a loadable theme. It is used to
1117// fail fast on an explicit --theme value, listing the available themes so the

Callers 7

runNewCommandMethod · 0.85
runDebugSkillsCommandMethod · 0.85
runDebugTitleCommandMethod · 0.85
CreateSessionMethod · 0.85
runOrExecMethod · 0.85
createSessionSpawnerMethod · 0.85

Calls 1

StopToolSetsMethod · 0.65

Tested by

no test coverage detected