MCPcopy Create free account
hub / github.com/docker/docker-agent / configureToolsetHandlers

Method configureToolsetHandlers

pkg/runtime/loop.go:1160–1180  ·  view source on GitHub ↗

configureToolsetHandlers sets up elicitation and OAuth handlers for all toolsets of an agent.

(a *agent.Agent, events EventSink)

Source from the content-addressed store, hash-verified

1158
1159// configureToolsetHandlers sets up elicitation and OAuth handlers for all toolsets of an agent.
1160func (r *LocalRuntime) configureToolsetHandlers(a *agent.Agent, events EventSink) {
1161 for _, toolset := range a.ToolSets() {
1162 tools.ConfigureHandlers(toolset,
1163 r.elicitationHandler,
1164 r.samplingHandler,
1165 func() { events.Emit(Authorization(tools.ElicitationActionAccept, a.Name())) },
1166 r.managedOAuth,
1167 r.unmanagedOAuthRedirectURI,
1168 )
1169
1170 // Wire RAG event forwarding so the TUI shows indexing progress.
1171 // Use a non-blocking sink because the RAG file watcher is a
1172 // long-lived goroutine that may outlive the per-message events
1173 // channel; a blocking send after the channel is closed would
1174 // crash, and a blocking send when the consumer has gone away
1175 // would deadlock.
1176 if ragTool, ok := tools.As[ragtypes.EventForwarder](toolset); ok {
1177 ragTool.SetEventCallback(ragEventForwarder(ragTool.Name(), r, nonBlocking(events).Emit))
1178 }
1179 }
1180}
1181
1182// emitAgentWarnings drains and emits any pending toolset warnings as
1183// persistent TUI notifications. Failures ("start failed", "list failed")

Callers 1

runStreamLoopMethod · 0.95

Calls 8

ConfigureHandlersFunction · 0.92
AuthorizationFunction · 0.85
ragEventForwarderFunction · 0.85
nonBlockingFunction · 0.85
ToolSetsMethod · 0.80
EmitMethod · 0.65
NameMethod · 0.65
SetEventCallbackMethod · 0.65

Tested by

no test coverage detected