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

Method skillSubSessionTools

pkg/runtime/loop.go:1262–1293  ·  view source on GitHub ↗

skillSubSessionTools augments the agent's tools for a fork-mode skill sub-session: it applies the skill's allowed-tools allow-list to the inherited agent tools, then appends the tools from the skill's assistive toolsets (which bypass the allow-list — the skill explicitly asked for them). It is a no-

(ctx context.Context, sess *session.Session, a *agent.Agent, agentTools []tools.Tool, events EventSink)

Source from the content-addressed store, hash-verified

1260// toolsets (which bypass the allow-list — the skill explicitly asked for
1261// them). It is a no-op for ordinary sessions that set neither field.
1262func (r *LocalRuntime) skillSubSessionTools(ctx context.Context, sess *session.Session, a *agent.Agent, agentTools []tools.Tool, events EventSink) []tools.Tool {
1263 if len(sess.AllowedTools) == 0 && len(sess.ExtraToolSets) == 0 {
1264 return agentTools
1265 }
1266
1267 agentTools = filterAllowedTools(agentTools, sess.AllowedTools)
1268
1269 for _, ts := range sess.ExtraToolSets {
1270 tools.ConfigureHandlers(ts,
1271 r.elicitationHandler,
1272 r.samplingHandler,
1273 func() { events.Emit(Authorization(tools.ElicitationActionAccept, a.Name())) },
1274 r.managedOAuth,
1275 r.unmanagedOAuthRedirectURI,
1276 )
1277 if startable, ok := tools.As[tools.Startable](ts); ok {
1278 if err := startable.Start(ctx); err != nil {
1279 slog.WarnContext(ctx, "Skill toolset failed to start; skipping",
1280 "agent", a.Name(), "toolset", tools.DescribeToolSet(ts), "error", err)
1281 continue
1282 }
1283 }
1284 extra, err := ts.Tools(ctx)
1285 if err != nil {
1286 slog.WarnContext(ctx, "Skill toolset listing failed; skipping",
1287 "agent", a.Name(), "toolset", tools.DescribeToolSet(ts), "error", err)
1288 continue
1289 }
1290 agentTools = append(agentTools, extra...)
1291 }
1292 return agentTools
1293}
1294
1295// reprobe re-runs ensureToolSetsAreStarted after a batch of tool calls.
1296// If new tools became available (by name-set diff), it emits a ToolsetInfo

Calls 8

ConfigureHandlersFunction · 0.92
DescribeToolSetFunction · 0.92
filterAllowedToolsFunction · 0.85
AuthorizationFunction · 0.85
EmitMethod · 0.65
NameMethod · 0.65
StartMethod · 0.65
ToolsMethod · 0.65