feat: add client-side tool guard
Merged
RA
2mo ago+479+479+012345678901234567890123456789-5-5-0123456789
Summary by cubic
Adds a configurable client-side guard that evaluates every call_tool invocation before tool lookup, discovery, or transport dispatch, so non-allowed calls never reach a native transport.
- Supports
allow,deny,review, anderrorverdicts; onlyallowdispatches, exactly once. - A
reviewverdict requires anapprove(call, review_verdict)method that must returnallow, otherwise the call fails without dispatching. bypass_toolsallowlist skips guard evaluation for intentionally safe, client-owned tools.- Invalid verdicts, evaluator crashes, and approval failures fail closed with structured
guard_*errors including the tool name, args, and verdict. - The guard can be a function or a table with
evaluate(call); existing clients without aguardconfig are unaffected.
Docs and examples
- Adds a guard example, README sections, Makefile target, and rockspec/init registration for
utcp.guard. - Adds tests covering deny, review, error, bypass, approval, and evaluator-crash paths.