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

Struct Toolset

pkg/tools/mcp/mcp.go:164–187  ·  view source on GitHub ↗

Toolset represents a set of MCP tools. Connection lifecycle (initial connect, watcher goroutine, restart with backoff, graceful Stop) is delegated to a *lifecycle.Supervisor; the historical watchConnection / tryRestart / forceReconnectAndWait helpers have been replaced by the supervisor's Start / R

Source from the content-addressed store, hash-verified

162// historical watchConnection / tryRestart / forceReconnectAndWait helpers
163// have been replaced by the supervisor's Start / RestartAndWait / Stop.
164type Toolset struct {
165 name string
166 mcpClient mcpClient
167 logID string
168 description string // user-visible description, set by constructors
169 instructions string
170
171 supervisor *lifecycle.Supervisor
172
173 mu sync.Mutex
174
175 // Cached tools and prompts, invalidated via MCP notifications and
176 // supervisor disconnect callbacks. cacheGen is bumped on each
177 // invalidation so that a concurrent Tools()/ListPrompts() call can
178 // detect that its result is stale and drop it.
179 cachedTools []tools.Tool
180 cachedPrompts []PromptInfo
181 cacheGen uint64
182
183 // toolsChangedHandler is called after the tool cache is refreshed
184 // following a ToolListChanged notification from the server, or after
185 // a successful supervisor reconnect.
186 toolsChangedHandler func()
187}
188
189// invalidateCache clears the cached tools and prompts and bumps the
190// generation counter. The caller must hold ts.mu.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected