List returns all observed tools sorted by format then name.
()
| 83 | |
| 84 | // List returns all observed tools sorted by format then name. |
| 85 | func (s *Store) List() []ObservedTool { |
| 86 | s.mu.RLock() |
| 87 | defer s.mu.RUnlock() |
| 88 | |
| 89 | if len(s.tools) == 0 { |
| 90 | return nil |
| 91 | } |
| 92 | |
| 93 | out := make([]ObservedTool, 0, len(s.tools)) |
| 94 | for _, t := range s.tools { |
| 95 | out = append(out, t) |
| 96 | } |
| 97 | sort.Slice(out, func(i, j int) bool { |
| 98 | if out[i].Format != out[j].Format { |
| 99 | return out[i].Format < out[j].Format |
| 100 | } |
| 101 | return out[i].Name < out[j].Name |
| 102 | }) |
| 103 | return out |
| 104 | } |
| 105 | |
| 106 | // Clear removes all observed tools. |
| 107 | func (s *Store) Clear() { |
no outgoing calls