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

Method getTools

pkg/runtime/loop.go:1140–1157  ·  view source on GitHub ↗

getTools executes tool retrieval with automatic OAuth handling. emitLifecycleEvents controls whether MCPInitStarted/Finished are emitted; pass false when calling from reprobe to avoid spurious TUI spinner flicker.

(ctx context.Context, a *agent.Agent, sessionSpan trace.Span, events EventSink, emitLifecycleEvents bool)

Source from the content-addressed store, hash-verified

1138// emitLifecycleEvents controls whether MCPInitStarted/Finished are emitted;
1139// pass false when calling from reprobe to avoid spurious TUI spinner flicker.
1140func (r *LocalRuntime) getTools(ctx context.Context, a *agent.Agent, sessionSpan trace.Span, events EventSink, emitLifecycleEvents bool) ([]tools.Tool, error) {
1141 if emitLifecycleEvents && len(a.ToolSets()) > 0 {
1142 events.Emit(MCPInitStarted(a.Name()))
1143 defer func() { events.Emit(MCPInitFinished(a.Name())) }()
1144 }
1145
1146 agentTools, err := a.Tools(ctx)
1147 if err != nil {
1148 slog.ErrorContext(ctx, "Failed to get agent tools", "agent", a.Name(), "error", err)
1149 sessionSpan.RecordError(err)
1150 sessionSpan.SetStatus(codes.Error, "failed to get tools")
1151 r.telemetry.RecordError(ctx, err.Error())
1152 return nil, err
1153 }
1154
1155 slog.DebugContext(ctx, "Retrieved agent tools", "agent", a.Name(), "tool_count", len(agentTools))
1156 return agentTools, nil
1157}
1158
1159// configureToolsetHandlers sets up elicitation and OAuth handlers for all toolsets of an agent.
1160func (r *LocalRuntime) configureToolsetHandlers(a *agent.Agent, events EventSink) {

Callers 3

runStreamLoopMethod · 0.95
reprobeMethod · 0.95

Calls 8

MCPInitStartedFunction · 0.85
MCPInitFinishedFunction · 0.85
ToolSetsMethod · 0.80
EmitMethod · 0.65
NameMethod · 0.65
ToolsMethod · 0.65
RecordErrorMethod · 0.65
ErrorMethod · 0.45

Tested by 1