Files
drharness/tests/test_tool_restrictions.sh
2026-05-09 12:26:08 -05:00

24 lines
767 B
Bash
Executable File

#!/bin/bash
# test_tool_restrictions.sh - Validates that unspecified tools cannot be used
# Create a file for read_file
cat > restrict_test.txt << 'INNER_EOF'
Some content
INNER_EOF
# We only specify edit tool via -t edit, but mock response asks for read_file
tool_call read_file '{"path":"restrict_test.txt"}' >> mock_responses.txt
be_done 'Restricted done' >> mock_responses.txt
# Run harness with only 'edit' tool specified
"${DRHARNESS}" -F chat.json -n -m "Try to use read_file but only edit is allowed" -t edit -d < "mock_responses.txt" >/dev/null 2>&1
# Write expected error to a file to compare via helper
cat > expected_error.txt << 'EOF'
Error: unknown tool: read_file
EOF
check_tool_call chat.json 2 expected_error.txt
echo "PASS: tool_restrictions"