MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / collectToolNamesFromPath

Function collectToolNamesFromPath

internal/toolinjection/injection.go:144–157  ·  view source on GitHub ↗

collectToolNamesFromPath extracts tool names using the given gjson path within each tool.

(rawJSON []byte, namePath string)

Source from the content-addressed store, hash-verified

142
143// collectToolNamesFromPath extracts tool names using the given gjson path within each tool.
144func 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.

Callers 3

collectToolNamesOpenAIFunction · 0.85
collectToolNamesClaudeFunction · 0.85

Calls 2

StringMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected