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)
| 481 | // reconnect timeout), so we run it inside a tea.Cmd goroutine and |
| 482 | // surface the result via a notification toast on completion. |
| 483 | func (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 |
no test coverage detected