MCPcopy Create free account
hub / github.com/github/gh-aw / validateWebSearchSupport

Method validateWebSearchSupport

pkg/workflow/agent_validation.go:215–232  ·  view source on GitHub ↗

validateWebSearchSupport validates that web-search tool is only used with engines that support this feature

(tools map[string]any, engine CodingAgentEngine)

Source from the content-addressed store, hash-verified

213
214// validateWebSearchSupport validates that web-search tool is only used with engines that support this feature
215func (c *Compiler) validateWebSearchSupport(tools map[string]any, engine CodingAgentEngine) {
216 // Check if web-search tool is requested
217 _, hasWebSearch := tools["web-search"]
218
219 if !hasWebSearch {
220 // No web-search specified, no validation needed
221 return
222 }
223
224 agentValidationLog.Printf("Validating web-search support for engine: %s", engine.GetID())
225
226 // web-search is specified, check if the engine supports it
227 if !engine.GetCapabilities().WebSearch {
228 agentValidationLog.Printf("Engine %s does not natively support web-search tool, emitting warning", engine.GetID())
229 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Engine '%s' does not support the web-search tool. See https://github.github.com/gh-aw/guides/web-search/ for alternatives.", engine.GetID())))
230 c.IncrementWarningCount()
231 }
232}
233
234// validateBareModeSupport validates that bare mode is only used with engines that support this feature.
235// Emits a warning and has no effect on engines that do not support bare mode.

Callers 1

Calls 5

IncrementWarningCountMethod · 0.95
FormatWarningMessageFunction · 0.92
GetIDMethod · 0.65
GetCapabilitiesMethod · 0.65
PrintfMethod · 0.45

Tested by

no test coverage detected