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

Method handleRestartToolset

pkg/tui/handlers.go:483–503  ·  view source on GitHub ↗

handleRestartToolset asks the runtime to restart the named toolset. The actual call can block for up to ~35s (the supervisor's reconnect timeout), so we run it inside a tea.Cmd goroutine and surface the result via a notification toast on completion.

(name string)

Source from the content-addressed store, hash-verified

481// reconnect timeout), so we run it inside a tea.Cmd goroutine and
482// surface the result via a notification toast on completion.
483func (m *appModel) handleRestartToolset(name string) (tea.Model, tea.Cmd) {
484 if name == "" {
485 return m, notification.ErrorCmd("usage: /toolset-restart <name>")
486 }
487 appRef := m.application
488 return m, tea.Batch(
489 notification.InfoCmd(fmt.Sprintf("Restarting toolset %q…", name)),
490 func() tea.Msg {
491 if err := appRef.RestartToolset(m.ctx(), name); err != nil {
492 return notification.ShowMsg{
493 Text: fmt.Sprintf("Failed to restart %q: %v", name, err),
494 Type: notification.TypeError,
495 }
496 }
497 return notification.ShowMsg{
498 Text: fmt.Sprintf("Toolset %q restarted", name),
499 Type: notification.TypeSuccess,
500 }
501 },
502 )
503}
504
505// --- MCP prompts ---
506

Callers 1

updateMethod · 0.95

Calls 4

ErrorCmdFunction · 0.92
InfoCmdFunction · 0.92
BatchMethod · 0.80
RestartToolsetMethod · 0.65

Tested by

no test coverage detected