startedToolNames returns the live tool names of ts, but only when it is a started toolset; the boolean is false for not-yet-started toolsets so the caller can fall back to the declared allow-list. context.TODO is safe here: the toolset is already started, so listing returns its cached tools without
(ctx context.Context, ts tools.ToolSet)
| 927 | // the toolset is already started, so listing returns its cached tools without |
| 928 | // a cancellable round-trip. |
| 929 | func startedToolNames(ctx context.Context, ts tools.ToolSet) ([]string, bool) { |
| 930 | s, ok := tools.As[*tools.StartableToolSet](ts) |
| 931 | if !ok || !s.IsStarted() { |
| 932 | return nil, false |
| 933 | } |
| 934 | tl, err := s.Tools(ctx) |
| 935 | if err != nil { |
| 936 | return nil, false |
| 937 | } |
| 938 | names := make([]string, 0, len(tl)) |
| 939 | for i := range tl { |
| 940 | if tl[i].Name != "" { |
| 941 | names = append(names, tl[i].Name) |
| 942 | } |
| 943 | } |
| 944 | return names, true |
| 945 | } |
| 946 | |
| 947 | // declaredToolNames maps each configured toolset's display name to its declared |
| 948 | // `tools:` allow-list. The key matches the registry's naming |
no test coverage detected