MCPcopy Index your code
hub / github.com/docker/docker-agent / OnToolsChanged

Method OnToolsChanged

pkg/runtime/runtime.go:1396–1410  ·  view source on GitHub ↗

OnToolsChanged registers a handler that is called when an MCP toolset reports a tool list change outside of a RunStream. This allows the UI to update the tool count immediately.

(handler func(Event))

Source from the content-addressed store, hash-verified

1394// reports a tool list change outside of a RunStream. This allows the UI
1395// to update the tool count immediately.
1396func (r *LocalRuntime) OnToolsChanged(handler func(Event)) {
1397 r.onToolsChanged = handler
1398
1399 for _, name := range r.team.AgentNames() {
1400 a, err := r.team.Agent(name)
1401 if err != nil {
1402 continue
1403 }
1404 for _, ts := range a.ToolSets() {
1405 if n, ok := tools.As[tools.ChangeNotifier](ts); ok {
1406 n.SetToolsChangedHandler(r.emitToolsChanged)
1407 }
1408 }
1409 }
1410}
1411
1412// emitToolsChanged is the callback registered on MCP toolsets. It re-reads
1413// the current agent's full tool list and pushes a ToolsetInfo event.

Callers

nothing calls this directly

Calls 4

AgentNamesMethod · 0.80
AgentMethod · 0.80
ToolSetsMethod · 0.80

Tested by

no test coverage detected