MCPcopy
hub / github.com/docker/docker-agent / runDebugTitleCommand

Method runDebugTitleCommand

cmd/root/debug.go:201–236  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

199}
200
201func (f *debugFlags) runDebugTitleCommand(cmd *cobra.Command, args []string) (commandErr error) {
202 telemetry.TrackCommand(cmd.Context(), "debug", append([]string{"title"}, args...))
203 defer func() { // do not inline this defer so that commandErr is not resolved early
204 telemetry.TrackCommandError(cmd.Context(), "debug", append([]string{"title"}, args...), commandErr)
205 }()
206
207 ctx := cmd.Context()
208
209 t, err := f.loadTeam(ctx, args[0], teamloader.WithModelOverrides(f.modelOverrides))
210 if err != nil {
211 return err
212 }
213 defer stopToolSets(ctx, t)
214
215 agent, err := t.DefaultAgent()
216 if err != nil {
217 return err
218 }
219
220 // Use the same title generation code path as the TUI (see runTUI in new.go),
221 // including any dedicated title_model configured for the agent's model.
222 models := agent.TitleModels(ctx)
223 if len(models) == 0 {
224 return fmt.Errorf("agent %q has no model configured", agent.Name())
225 }
226 gen := sessiontitle.New(models[0], models[1:]...)
227
228 title, err := gen.Generate(ctx, "debug", []string{args[1]})
229 if err != nil {
230 return fmt.Errorf("generating title with agent %q: %w", agent.Name(), err)
231 }
232
233 fmt.Fprintln(cmd.OutOrStdout(), title)
234
235 return nil
236}

Callers

nothing calls this directly

Calls 11

loadTeamMethod · 0.95
TrackCommandFunction · 0.92
TrackCommandErrorFunction · 0.92
WithModelOverridesFunction · 0.92
NewFunction · 0.92
stopToolSetsFunction · 0.85
ContextMethod · 0.80
DefaultAgentMethod · 0.80
TitleModelsMethod · 0.80
GenerateMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected