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

Function DescribeToolSet

pkg/tools/startable.go:25–37  ·  view source on GitHub ↗

DescribeToolSet returns a short description for ts suitable for user-visible messages. It walks the wrapper chain (e.g. through WithName / StartableToolSet) so any inner Describer is reachable; falls back to the Go type name when no inner toolset implements Describer.

(ts ToolSet)

Source from the content-addressed store, hash-verified

23// StartableToolSet) so any inner Describer is reachable; falls back to
24// the Go type name when no inner toolset implements Describer.
25func DescribeToolSet(ts ToolSet) string {
26 if d, ok := As[Describer](ts); ok {
27 if desc := d.Describe(); desc != "" {
28 return desc
29 }
30 }
31 // Unwrap once for the type-name fallback so wrappers don't show up
32 // as e.g. "*tools.namedToolSet".
33 if u, ok := ts.(Unwrapper); ok {
34 ts = u.Unwrap()
35 }
36 return fmt.Sprintf("%T", ts)
37}
38
39// failureStreak implements once-per-streak warning de-duplication. A streak
40// begins on the first fail() and ends on reset() (a success or a Stop).

Calls 2

DescribeMethod · 0.65
UnwrapMethod · 0.65