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)
| 220 | // (OnDisconnect, OnRestart, Logger) are always set by the constructor |
| 221 | // and any values passed in for those fields are ignored. |
| 222 | func 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 | // |