tool-arg-match 442 B

1234567891011121314151617
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. command -v jq >/dev/null || { echo "jq required"; exit 127; }
  4. TOOL="$1"
  5. FILTER="$2"
  6. FILE="tool_calls.jsonl"
  7. MATCHES=$(jq -s "[.[] | select(.tool == \"$TOOL\") | select(.args | $FILTER)] | length" "$FILE" 2>/dev/null || echo 0)
  8. if [ "$MATCHES" -gt 0 ]; then
  9. echo "PASS: $TOOL has $MATCHES call(s) matching filter"
  10. exit 0
  11. else
  12. echo "FAIL: no $TOOL calls match filter: $FILTER"
  13. exit 1
  14. fi