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

Method RestartToolset

pkg/runtime/runtime.go:1040–1059  ·  view source on GitHub ↗

RestartToolset locates the named toolset on the active agent and asks it to restart in place. The supervisor closes the current session and reconnects; this method blocks until the new session is Ready, ctx is cancelled, or the underlying supervisor's timeout elapses. Returns an error when: - no to

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

1038// built-in), so non-restartable matches are skipped rather than aborting:
1039// the first restartable toolset with the given name wins.
1040func (r *LocalRuntime) RestartToolset(ctx context.Context, name string) error {
1041 a := r.CurrentAgent()
1042 if a == nil {
1043 return errors.New("no active agent")
1044 }
1045 found := false
1046 for _, ts := range a.ToolSets() {
1047 if nameFor(ts, tools.DescribeToolSet(ts)) != name {
1048 continue
1049 }
1050 found = true
1051 if restartable, ok := tools.As[tools.Restartable](ts); ok {
1052 return restartable.Restart(ctx)
1053 }
1054 }
1055 if found {
1056 return fmt.Errorf("toolset %q does not support restart", name)
1057 }
1058 return fmt.Errorf("toolset %q not found", name)
1059}
1060
1061// toolsetStatusFor builds a ToolsetStatus for ts. tools.As walks the
1062// wrapper chain so Statable/Describer can live anywhere in the stack.

Callers

nothing calls this directly

Calls 6

CurrentAgentMethod · 0.95
DescribeToolSetFunction · 0.92
nameForFunction · 0.85
ToolSetsMethod · 0.80
RestartMethod · 0.65
NewMethod · 0.45

Tested by

no test coverage detected