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

Function ResponseHasToolCalls

internal/toolinjection/response_check.go:13–19  ·  view source on GitHub ↗

ResponseHasToolCalls reports whether a response body (streaming buffer or non-streaming JSON) contains tool/function calls that require agent execution. When true, this is an intermediate response in a multi-turn conversation and NOT the final text answer — so CompletePoisonCycle should be deferred.

(buf []byte, format string)

Source from the content-addressed store, hash-verified

11// When true, this is an intermediate response in a multi-turn conversation and
12// NOT the final text answer — so CompletePoisonCycle should be deferred.
13func ResponseHasToolCalls(buf []byte, format string) bool {
14 f := GetFormat(format)
15 if f == nil {
16 return false
17 }
18 return f.HasToolCalls(buf)
19}
20
21// openAIHasToolCalls checks OpenAI Chat Completions format.
22// Non-streaming: single JSON with choices[0].finish_reason.

Calls 2

GetFormatFunction · 0.85
HasToolCallsMethod · 0.65