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

Method runDebugSkillsCommand

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

Source from the content-addressed store, hash-verified

149}
150
151func (f *debugFlags) runDebugSkillsCommand(cmd *cobra.Command, args []string) (commandErr error) {
152 telemetry.TrackCommand(cmd.Context(), "debug", append([]string{"skills"}, args...))
153 defer func() { // do not inline this defer so that commandErr is not resolved early
154 telemetry.TrackCommandError(cmd.Context(), "debug", append([]string{"skills"}, args...), commandErr)
155 }()
156
157 ctx := cmd.Context()
158
159 t, err := f.loadTeam(ctx, args[0])
160 if err != nil {
161 return err
162 }
163 defer stopToolSets(ctx, t)
164
165 out := cli.NewPrinter(cmd.OutOrStdout())
166
167 for _, name := range t.AgentNames() {
168 agent, err := t.Agent(name)
169 if err != nil {
170 slog.ErrorContext(ctx, "Failed to get agent", "name", name, "error", err)
171 continue
172 }
173
174 var skillsToolset *skillstool.ToolSet
175 for _, ts := range agent.ToolSets() {
176 if st, ok := tools.As[*skillstool.ToolSet](ts); ok {
177 skillsToolset = st
178 break
179 }
180 }
181
182 if skillsToolset == nil || len(skillsToolset.Skills()) == 0 {
183 out.Printf("No skills for %s\n", agent.Name())
184 continue
185 }
186
187 loadedSkills := skillsToolset.Skills()
188 out.Printf("%d skill(s) for %s:\n", len(loadedSkills), agent.Name())
189 for _, skill := range loadedSkills {
190 marker := ""
191 if skill.IsFork() {
192 marker = " [forked]"
193 }
194 out.Println(" +", skill.Name+marker, "-", skill.Description)
195 }
196 }
197
198 return nil
199}
200
201func (f *debugFlags) runDebugTitleCommand(cmd *cobra.Command, args []string) (commandErr error) {
202 telemetry.TrackCommand(cmd.Context(), "debug", append([]string{"title"}, args...))

Callers

nothing calls this directly

Calls 14

loadTeamMethod · 0.95
SkillsMethod · 0.95
PrintfMethod · 0.95
PrintlnMethod · 0.95
TrackCommandFunction · 0.92
TrackCommandErrorFunction · 0.92
NewPrinterFunction · 0.92
stopToolSetsFunction · 0.85
ContextMethod · 0.80
AgentNamesMethod · 0.80
AgentMethod · 0.80
ToolSetsMethod · 0.80

Tested by

no test coverage detected