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

Struct StartableToolSet

pkg/tools/startable.go:85–98  ·  view source on GitHub ↗

StartableToolSet wraps a ToolSet with lazy, single-flight start semantics. This is the canonical way to manage toolset lifecycle. It also de-duplicates failure warnings: when Start() fails repeatedly (e.g. an MCP server is down), only the *first* failure of each streak is reported via ShouldReportF

Source from the content-addressed store, hash-verified

83// MCP server stuck returning "toolset not started" therefore surfaces a single
84// warning per streak instead of one on every conversation turn.
85type StartableToolSet struct {
86 ToolSet
87
88 mu sync.Mutex
89 started bool
90 startStreak failureStreak // Start() failures
91 listStreak failureStreak // Tools() listing failures
92 // recoveryStreak tracks once-per-streak notices specifically for
93 // recovery failures (the toolset was previously started and working,
94 // then Start failed again). Distinct from startStreak so callers can
95 // emit a different, more targeted message (e.g. "needs re-auth" vs
96 // "start failed") for the recovery case.
97 recoveryStreak failureStreak
98}
99
100// NewStartable wraps a ToolSet for lazy initialization.
101func NewStartable(ts ToolSet) *StartableToolSet {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected