promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

The tool contract — make the dangerous call a validation error — step 7 of 7

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Checkpoint. It's the end of a triage run and you're auditing the call log. Four of these are what the model proposed; the escalate went out after on-call approved it — that's where its confirmed: True came from, since the model never sets that flag on its own calls. Write gate_calls(calls) that returns a list of rows — one dict {"tool": ..., "verdict": ...} per call, same order — where verdict comes from validate_call (same five rules as the last step: unknown tool, missing required, bad allowed value, needs confirm, ok).

Then print each row, count the verdicts, and end with the summary line. Note the model tried to call rm_rf — a tool that doesn't exist in this registry, which is exactly why "unknown tool" is a reject and not a KeyError.

Expected output:

read_log_tail  ok
rerun_job      reject: needs confirm
open_issue     reject: bad severity
escalate       ok
rm_rf          reject: unknown tool
2 ok / 3 rejected — schema held

full-screen editor opens — close anytime to keep reading.