collectToolNamesFromPath extracts tool names using the given gjson path within each tool.
(rawJSON []byte, namePath string)
| 142 | |
| 143 | // collectToolNamesFromPath extracts tool names using the given gjson path within each tool. |
| 144 | func collectToolNamesFromPath(rawJSON []byte, namePath string) []string { |
| 145 | tools := gjson.GetBytes(rawJSON, "tools") |
| 146 | if !tools.Exists() || !tools.IsArray() { |
| 147 | return nil |
| 148 | } |
| 149 | var names []string |
| 150 | tools.ForEach(func(_, tool gjson.Result) bool { |
| 151 | if name := tool.Get(namePath).String(); name != "" { |
| 152 | names = append(names, name) |
| 153 | } |
| 154 | return true |
| 155 | }) |
| 156 | return names |
| 157 | } |
| 158 | |
| 159 | // countExistingInjections counts how many injected tool call IDs already exist |
| 160 | // in the conversation messages. |
no test coverage detected