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

Function NewToolsetCommand

pkg/tools/mcp/mcp.go:222–234  ·  view source on GitHub ↗

NewToolsetCommand creates a new MCP toolset from a command. The optional policy lets callers tune restart/backoff behaviour. When the zero value is passed the supervisor uses its built-in defaults (RestartOnFailure, 5 attempts, 1s..32s backoff). Internal callbacks (OnDisconnect, OnRestart, Logger)

(name, command string, args, env []string, cwd string, policy ...lifecycle.Policy)

Source from the content-addressed store, hash-verified

220// (OnDisconnect, OnRestart, Logger) are always set by the constructor
221// and any values passed in for those fields are ignored.
222func NewToolsetCommand(name, command string, args, env []string, cwd string, policy ...lifecycle.Policy) *Toolset {
223 slog.Debug("Creating Stdio MCP toolset", "command", command, "args", args)
224
225 desc := buildStdioDescription(command, args)
226 ts := &Toolset{
227 name: name,
228 mcpClient: newStdioCmdClient(command, args, env, cwd),
229 logID: command,
230 description: desc,
231 }
232 ts.supervisor = newSupervisor(ts, firstOrZero(policy))
233 return ts
234}
235
236// NewRemoteToolset creates a new MCP toolset from a remote MCP Server.
237//

Calls 5

buildStdioDescriptionFunction · 0.85
newStdioCmdClientFunction · 0.85
newSupervisorFunction · 0.85
firstOrZeroFunction · 0.85
DebugMethod · 0.80