MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _validate_input

Function _validate_input

src/tool_system/tools/web_search.py:266–280  ·  view source on GitHub ↗

Validate web search input, including mutual exclusion of domain filters.

(tool_input: dict[str, Any], _ctx: ToolContext)

Source from the content-addressed store, hash-verified

264# ---------------------------------------------------------------------------
265
266def _validate_input(tool_input: dict[str, Any], _ctx: ToolContext) -> ValidationResult:
267 """Validate web search input, including mutual exclusion of domain filters."""
268 query = tool_input.get("query", "")
269 if not isinstance(query, str) or not query.strip():
270 return ValidationResult.fail("Error: Missing query", error_code=1)
271
272 allowed = tool_input.get("allowed_domains")
273 blocked = tool_input.get("blocked_domains")
274 if allowed and blocked:
275 return ValidationResult.fail(
276 "Error: Cannot specify both allowed_domains and blocked_domains in the same request",
277 error_code=2,
278 )
279
280 return ValidationResult.ok()
281
282
283# ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
failMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected